Sample

Schnappinger/junit4/org.junit.experimental.categories.CategoryFilterFactory

Human rating uses the original dataset scale.

Human3.93
Lines48

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
59.5Δ 0.2
Scalabrino0.6230–1; higher is more readable
25.3Δ 34.4
Dorn0.680–1; higher is more readable
72.6Δ 12.9
Mi0.4460–1; higher is more readable
27.7Δ 32.0
LLOC11Logical lines; fewer is more readable
70.6Δ 10.9
DeepSeek V4 Pro180–20; mean of three runs
91.4Δ 31.7
GPT-6.1 Sol180–20; mean of three runs
73.8Δ 14.0
BTTF0.7060–1; higher is more readable
82.8Δ 23.1
Human3.931–4; original rating
59.7

Views

Source code

package org.junit.experimental.categories; import java.util.ArrayList; import java.util.List; import org.junit.internal.Classes; import org.junit.runner.FilterFactory; import org.junit.runner.FilterFactoryParams; import org.junit.runner.manipulation.Filter; /** * Implementation of FilterFactory for Category filtering. */ abstract class CategoryFilterFactory implements FilterFactory { /** * Creates a {@link org.junit.experimental.categories.Categories.CategoryFilter} given a * {@link FilterFactoryParams} argument. * * @param params Parameters needed to create the {@link Filter} * @throws FilterNotCreatedException */ public Filter createFilter(FilterFactoryParams params) throws FilterNotCreatedException { try { return createFilter(parseCategories(params.getArgs())); } catch (ClassNotFoundException e) { throw new FilterNotCreatedException(e); } } /** * Creates a {@link org.junit.experimental.categories.Categories.CategoryFilter} given an array of classes. * * @param categories Category classes. */ protected abstract Filter createFilter(List<Class<?>> categories); private List<Class<?>> parseCategories(String categories) throws ClassNotFoundException { List<Class<?>> categoryClasses = new ArrayList<Class<?>>(); for (String category : categories.split(",")) { Class<?> categoryClass = Classes.getClass(category); categoryClasses.add(categoryClass); } return categoryClasses; } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.1141.233−37.661
Source linesThe number of non-empty source lines.48+19.2
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.579−6.868

Intercept 8.87 + feature contributions = -16.459 (log-odds).
Score = sigmoid(-16.459) = 0.

Score0.623

Feature contributions

FeatureValueContribution
(log-odds)
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.110.98−1.035
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.108.735+0.95
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.49−0.699
Indentation frequencyHow rapidly indentation changes from line to line.36+0.508
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.066+0.302
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.47.911+0.26

Intercept 0.07 + feature contributions = 0.754 (log-odds).
Score = sigmoid(0.754) = 0.68.

Score0.446
Score11
Run 1

The code is well-structured with clear separation of concerns: public API, abstract factory method, and private parsing logic. Nesting is minimal, with only a try-catch block and a simple loop. Intent is clearly documented through Javadoc and method names. The code is concise without unnecessary boilerplate. Action granularity is appropriate—each logical step (splitting, resolving class, adding to list) is on its own line. Reading flow is natural, following top-down order from public method to implementation details. Minor deductions: the comment '@throws FilterNotCreatedException' could be more descriptive, and the parsing logic could potentially be extracted into a utility class if reused elsewhere. Overall, this is highly readable, production-quality code.

Run 2

The code is well-structured and highly readable. It has a clear single responsibility per method: createFilter delegates parsing and filter creation, while parseCategories handles conversion. Nesting is minimal, with a simple try-catch and a for loop. Intent is explicit through descriptive method names and Javadoc. The code is concise without being overly compressed—each line performs one logical action, improving readability. Reading flow is natural: public API first, then abstract protected method, then private helper. Minor deductions: the exception handling adds slight indirection, and the split(",") magic delimiter could be a named constant, but overall this is exemplary clarity.

Run 3

The code is highly readable with clear structure and purpose. It follows single responsibility by separating filter creation, category parsing, and exception handling. Nesting is minimal, with only one try-catch and one loop. Method names are descriptive and intent is obvious. The code is concise, avoiding unnecessary verbosity. Each action is on its own line, and reading flow is natural from high-level filter creation down to parsing details. Minor deductions: 'parseCategories' could be static, and the Javadoc could include @throws for the abstract method.

Run 1

Code Structure: Well-organized methods separate argument parsing, filter creation, and exception translation. Nesting: Shallow, with only a simple try/catch and loop. Clarity of intent: Descriptive names and Javadoc make category-based filter construction easy to understand, though overloaded createFilter methods require slight attention. Code length: Concise implementation; some documentation is repetitive. Action granularity: Each statement performs one clear action, and the intermediate categoryClass variable makes class loading explicit. Reading flow: The public entry point leads naturally to the abstract extension point and private parsing helper. Consistent formatting supports readability.

Run 2

Code Structure: Well organized, separating parameter handling, category parsing, and subclass-specific filter creation. Nesting: Shallow, with only a try/catch and a simple loop. Clarity of intent: Descriptive names and documentation make the purpose clear, though overloaded createFilter methods require slight attention. Code length: Concise overall; lengthy fully qualified Javadoc references add minor visual clutter. Action granularity: Statements generally perform one action per line, and class loading is separated from list insertion. Reading flow: Natural top-to-bottom progression from the public entry point to the abstract extension point and private parsing helper. Minor whitespace and documentation verbosity slightly reduce readability.

Run 3

Code Structure: Clearly separates argument parsing, filter creation, and exception translation into focused methods. Nesting: Minimal, with only a simple try/catch and a flat loop. Clarity of intent: Descriptive method and variable names, supported by Javadoc, make category filtering easy to understand; overloaded createFilter methods introduce slight ambiguity. Code length: Concise overall, though some documentation and blank lines are more verbose than necessary. Action granularity: Statements generally perform one action each; the nested calls in the return statement compactly combine argument retrieval, parsing, and filter creation. Reading flow: Natural progression from the public entry point to the abstract extension point and private parsing helper.