bs skunk

When Code Smells Twice as Much: Metric-Based Detection of Variability-Aware Code Smells

— Supplementary Material for SCAM 2015 —

Motivation and Overview

Highly-configurable software systems (also known as software product lines) gain momentum in both, academia and industry. For instance, the Linux kernel comes with over 12,000 configuration options and thus, can be customized to run on a variety of system with different properties such as architecture or processor. To a large degree, this configurability is achieved through variable code structures, for instance, using conditional compilation with the C preprocessor. Such source code variability adds a new dimension of complexity and thus, giving rise to new possibilities for design flaws. Code smells are an established concept to describe design flaws or decay in source code. However, existing smells, so far, had no notion of variability and thus fail to suitably characterize flaws of variable code structures. In previous work, we addressed this lack of varibaility support by proposing an initial catalog of six variability-aware code smells [VaMoS 2015]. In the respective paper, we discuss the appearance and negative effects of these smells and present code examples from real-world systems. To evaluate our catalog, we also conducted a survey amongst 15 researchers from the field of software product lines. As a key result of this survey, we can confirm that our proposed smells a) have been observed in existing product lines and b) are considered to be problematic for important software development activities, such as program comprehension, maintenance, and evolution. However, so far we have no empirical evidence how common these smells are in software systems. In our paper (belonging to this page), we propose a metric-based method to detect variability-aware code smells. In particular, we evaluate our method with one smell, Annotation Bundle in five real-world software systems of medium size, namely: emacs, vim, php, lynx, libxml2. On this page, we provide supplementary material for both, our detection methods as well as the empirical study.

Skunk — A Variability-Aware Code Smell Detector

For detecting our proposed, variability-aware code smells, we built a tool called Skunk , in with we implemented our metric-based detection algorithm. Our vision is to extend Skunk in an iterative manner, thus, adding more and more variability-related smells, but also improving the detection algorithm itself. While currently only focussing solely on variability-aware smells, it is generallly possible to extend Skunk for detecting traditional smells. Below we provide an overview of the overall workflow of Skunk .


In the first step, we analyze the subject system in order to extract metrics, used for the second stept. To this end, we employ two existing tools: CppStats (website) and src2srcML (website). While CppStats extracts a variety of metrics, covering the nature of CPP variability in C programs, src2srcML basically provides an AST-like representation of the program in XML format. From the latter, we extract additional information, such as locations of function definitions or function calls.
Since src2srcML is integrated in CppStats , it is sufficient to run CppStats only to obtain the XML-like source code representation, provided src2srcML .

For more information about CppStats , including the source code, we refer to the corresponding github repository:

Code Smell Detection

Based on the extracted data, we perform the actual code smell detection in the second step. To this end, smell-specific metrics are used and a corresponding code smell template is provided to parametrize thresholds for particular metrics and change weighting factors. Details for paramtrization of the Annotation Bundle smell can be found in the paper. Then, the smell deteciton algorithm uses these templates during detection to filter out those code fragments (e.g., functions) that are below specified thresholds (in case that those are marked as mandatory). Finally, a list of potential smells is obtained and stored as .csv file. Skunk is available on Github, containing the sources and a HowTo.txt file that describes how to use it. Give it a try!!

Case Study

For the evaluation of our metric-based method, we conducted a case study, comprising five open-source software systems: emacs, libxml2, lynx, php, and vim. Next, we provide both, the results for the initial result set (after clone detection) and for the reduced sample set. For the latter, we also provide the respective C functions extracted in separate files, together with information about its original location.


For our detection method, we propose several metrics, used to finally spot potential Annotation Bundle smells. While they are basically subsumed by the overall metric, AB-smell, proposed in the paper, we list all of them in the initial result set (see above). Hence, we briefly explain the particular metrics

Metric Full name Description
LOC Lines of Code Source lines of code of the function, ignoring blank lines and comments.
LOAC Lines of annotated code Source lines of code in all feature locations within the function. Lines that occur in a nested feature location are counted only once. Again, blank lines and comments are ignored.
LOFC Lines of feature code In contrast to the LOAC metric, this metric counts annotated code multiple times if the corresponding feature expression consists of more than one feature constant. For instance, if we have 10 lines of annotated code and the feature expression is A || B, this metric would report 20 lines (i.e., the actual number of lines multiplied with number of feature

NOFL Number of feature locations Number of blocks annotated with an #ifdef. An #ifdef containing a complex expression, such as #if defined(A) && defined(B), counts as a single feature location. An #ifdef with an #else or #elif branch counts as two feature locations
NOFCDup Number of feature constants (with duplicates) number of feature constants, accumulated over all feature locations within the scope (e.g., for the Annotation Bundle smell, our scope is a particular function). Feature constants that occur in multiple feature locations are counted multiple times.
NOFCNonDup Number of feature constants (without duplicates) Same as above, but without duplicates, that is, each feature constant is counted only one time, independent of how often it may occur in the considered scope.
NDacc Accumulated nesting depth Nesting depth of annotations, accumulated over all feature locations within the scope. An #ifdef that is not enclosed by another #ifdef is called a top-level #ifdef and has a nesting depth of zero; an #ifdef within a top-level #ifdef has a nesting depth of one, and so on. Nesting values are accumulated, which means that a function containing two feature locations with a nesting depth of one is assigned an NDacc value of 2.

Material and HowTo

After download, extract the content to a place of your choice. In particular, the archive comprises i) the original source files, ii) the xml files, created by src2srcML (subfolders _cppstats and _cppstats_featurelocations), and iii) three .csv files, containing basic metrics, computed by CppStats .

Next, you can run our smell detector on the example. To this end, you have the following options (with SKUNK_HOME being the root folder of Skunk ).

    Preprocessing and Detection This option comprises both, preprocessing the data provided by CppStats and the actual smell detection. To this end, you must run Skunk with the following arguments:
    The first argument indicates that running Skunk includes the preprocessing step. The second argument specifies that the result of the preprocessing should be stored. As a result, three .xml files will be stored in the SKUNK_HOME folder. The final argument is optional and refers to the template for the Annotation Bundle Smell, applied during code smell detection. In particular, the provided template fiel contains four mandatory thresholds, as explained in the paper.

When Code Smells Twice as Much: Metric-Based Detection of Variability-Aware Code Smells — Supplementary Material for SCAM 2015 — Motivation and Overview Highly-configurable software

bs skunk

By Admin
Post date

Super Skunk

Super Sunk is an indica marijuana strain made by crossing Skunk #1 with Afghani. This strain produces bold, relaxing effects that you can feel through your entire body. Medical marijuana patients choose Super Skunk to help relieve symptoms associated with chronic stress and pain. Super Skunk is ideal for anyone who enjoys an extra skunky aroma.

Super Sunk is an indica marijuana strain made by crossing Skunk #1 with Afghani. This strain produces bold, relaxing effects that you can feel through your entire body. Medical marijuana patients choose Super Skunk to help relieve symptoms associated with chronic stress and pain. Super Skunk is ideal for anyone who enjoys an extra skunky aroma.

Super Skunk is an indica cannabis strain.

What Is ‘Skunk Weed’ and Where Did It Originate?

Anyone who has travelled to even the most minimal extent knows that words can sometimes change depending on area. Over time, these words evolve along with changes to society and the actual people using the words. We’ve already covered the nuances in cannabis industry terminology on a broad level; now we’re going to look into a specific phrase in cannabis terminology: “skunk cannabis,” or as it’s more commonly referred to, “skunk weed.”

“Skunk” in the United States

In order to understand the meaning behind the word, it’s important to take a step back and look at the etymology of the word “skunk.” In the States, the meaning of the term is inextricably linked to everyone’s favorite, liquid-spraying mammal, the skunk. Despite the brave reputation restoration battle fought by the suave Pepé Le Pew, skunks are still mostly known for possessing an amazing defense mechanism, their eye-watering odor.

Unsurprisingly, this descriptor was chosen as the perfect fit for certain cannabis strains that emerged in the 1970’s and seems, in the U.S. at least, to have retained that meaning in the public’s consciousness. “Skunky” smells “stinky”; this is a term that has old-school marijuana references and is probably one of the most common smells associated with cannabis.

“Skunk” in the United Kingdom

The word “skunk” is also commonly used in the United Kingdom, but there the term has taken on a new life and is far more popularly used in a different context.

When media in the United Kingdom speak about skunk, they mean all high-THC cannabis varieties, regardless of their genetic heritage. In the U.K., skunk is widely used as a generic term for non-pollinated, seedless, and potent cannabis flowers grown for the purpose of smoking.

Sinsemilla became widespread in the U.K. in the early 1990s after a revolution in growing techniques, typically incorporating the use of high-pressure sodium lighting (HPS) and other high-intensity discharge (HID) lamps, often combined with the use of hydroponics (i.e. growing plants in nutrient-rich liquids rather than in soil).

The First “Skunk” in Cannabis Culture

For some smokers, skunk has simply become another generic word for cannabis. Not only is the generalization inaccurate, it also undermines the true genetic identity of the plant, as true skunk is an independent strain with its origins dating back to the 1970’s.

In the 1970s, growers in the USA began to crossbreed short, mountain hashish strains, mostly from Afghanistan and Pakistan with the tall, potent sativa cannabis strains from Central and South America, and strains from tropical Asia. These cross breeds could be grown outdoors in marginal climates in the USA such as northern California, in greenhouses in the Netherlands, and indoors under HID lamps.

Later appropriately named Skunk #1, the first skunk was stabilized as a true breeding variety in the 70’s and is still one of the most consistent and predictable strains available today. Breeders produced a plant that is highly adaptable, very potent, and with a short flowering period.

The original skunk cannabis strains were known to have a very pungent, dead animal-like smell reminiscent of a skunk. Thus, the name has stuck because it is fitting.

Skunk #1 is a hybrid strain that has influenced cannabis on a global scale, parenting a horde of skunk crosses. The strain was developed during the early 1970’s in California by a group of growers and breeders known as Sacred Seeds, led by the mythological David Watson who is more widely known by his moniker Sam the Skunkman.

Following his release from prison in 1982, the Skunkman brought several kilos of these seeds with him when he moved to the Netherlands. Once there, he made his way to Amsterdam, where he founded Cultivators Choice seed company. Dutch growers have since refined and cross-bred the plants to produce a number of strains including Super Skunk, Early Girl, Northern Lights, and Jack Herer.

Reefer Madness in the U.K.

Cannabis is the most widely used illegal drug in the U.K., although its consumption in recent years has fallen. The proportion of 11 to 15 year olds in England who had used cannabis dropped from 13.3% in 2003 to 7% in 2013, while the proportion of 16 to 59 year olds using cannabis in the same period fell from 10.6% to 6.6%.

Still, the variety of cannabis colloquially known as “skunk” has attracted much publicity in recent times. Much of this publicity is inaccurate, describing the strain as a “super-weed” and even implying it is a new drug entirely. Skunk is simply a variety of cannabis developed for indoor cultivation, producing hybrid plants, with early flower development, and a pungent aroma.

According to DrugWise, traditional cannabis contains 2 to 4 percent THC with more potent varieties averaging 10 to 14 percent. Claims that skunk is 20 to 30 times as powerful as “traditional” cannabis are simply spurious. A European review of cannabis potency in June 2004 concluded that the overall potency of cannabis products on the market had not increased significantly because imported cannabis dominated the market in most countries. However, as home-grown cannabis has become more widely available, especially in the U.K., consumption of stronger varieties has increased.

Generally, the UK media cover cannabis accurately, but some of the headline writers occasionally overstep the mark. The Sun‘s article, “Scientists warn smoking ‘skunk’ cannabis wrecks brains,” and the Daily Mail‘s companion pieces, “Proof strong cannabis does harm your brain” and “cannabis TRIPLES psychosis risk,” were not based on sufficient evidence to justify the extravagant headlines.

The first study found that skunk users underwent structural changes in the corpus callosum. This type of study cannot prove cause and effect, only suggest a possible link, so “proof” is by far too strong a term to use. Also, the study didn’t look at how the small changes in the brain associated with skunk affected thoughts or other brain functioning, so it was not fair to say skunk “wrecks” the brain.

What this study doesn’t tell us is whether these structural changes do any harm or cause any negative mental health effects, which is why The Sun‘s headline is too strong. The study simply didn’t look at this, and the effects of cannabis use are not firmly established.

This study wasn’t designed to look at the effect of skunk on mental health illnesses, only small changes in brain structure, so it tells us little about the link between cannabis use and the development of a mental health illness. Of course, cause and effect cannot be illustrated with a study like this. By definition, the only type of connection here is a correlation, and correlation does not necessarily equal causation.

Regarding the study which served as a basis for headlines such as “cannabis triples psychosis risk,” there are shortcomings in the research that are not addressed in the sensationalized headings. While Sir Robin Murray, professor of psychiatric research at King’s College London, doesn’t wholly discount the findings, he warns that the study doesn’t provide a causal link:

“The argument initially was that the people who are going to smoke cannabis are a bit odd anyway … In south London, two-thirds of people have used cannabis and it seems unlikely that two-thirds of people are abnormal.”

Crucially, skunk and hash use was self-reported in this study, so we have to assume that participants knew what they were smoking, and can only guess at the true levels of THC and CBD in the cannabis being used. Ideally, samples would have been taken and the precise levels of these cannabinoids assessed, but this isn’t practical in studies of this size and design.

This meant that researchers had to rely on patients being good judges of how often they smoked, how much and, most importantly, what they smoked. Considering there are all sort of street smokes sold all over South London, like synthetic powerful highs known as “Spice,” the findings become even more controversial. A more refined, close to reality reporting would have been obtained if blood tests and analysis had been made.

The problem with the term “skunk” is that it’s almost totally ambiguous. Sure, it pertains to strong weed, but there is a real lack of concrete information on the product that people are consuming, hence the necessity to generalize it as skunk.

“Skunk Cannabis” Summarized

We’ve learned that skunk is not only an adjective employed to describe the distinctive smell of cannabis in the U.S., it’s also a general term that is used as a blanket description for all potent, high-THC strains in the U.K. This strain also has genuine pedigree; it’s a 70’s superstar that has been transformed, kept up with the times, and exerted influence down through the decades to become a staple in the weed world.

What is the reason behind the division of meaning, though? Why does skunk imply stink in the U.S. but potency in the UK? My theory is that the lack of information regarding cannabis in the U.K. is so severe, especially in terms of identifying genetics and true lineages, that the term “skunk” is used as a convenient catch-all for unidentified weed.

Just as the term originally developed to describe a potent, aroma-rich strain in the U.S. and the Netherlands, the term “skunk” never lost its association with strong weed in the U.K. Essentially, a misunderstanding occurred. While in the U.S. a very specific cannabis culture emerged allowing the identification of myriad strains, that development never happened in the U.K. Skunk became the street nomenclature of last resort and emerged in popular culture as the go-to label for any high-THC strain.

In the U.K., people haven’t stopped smoking cannabis because it’s illegal, but they’re subjected to the dangers of an inferior product with no quality control, no freedom of consumer choice, and no thorough testing or data on strain genetics. Unfortunately, anti-cannabis crusaders like to possess a core argument to maintain the illegality of cannabis, and skunk is a convenient target.

The term “skunk” embodies the problem in microcosm: a general term masking a dearth of knowledge as a consequence of prohibition. As always, the solution should be more accurate information, not less, leading to better informed and safer consumers.

You might have heard the term “skunk weed,” but what does it mean? Follow an etymological dig into the word “skunk” and how it connects to cannabis.

Super Skunk Super Sunk is an indica marijuana strain made by crossing Skunk #1 with Afghani. This strain produces bold, relaxing effects that you can feel