Sample

int-4b3f9beeba89-I03

Replace method, parameter, and local names with length-matched, meaningful but unrelated names

Matched original source

Lines54

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.8290–1; higher is more readable
Dorn0.830–1; higher is more readable
Mi0.5650–1; higher is more readable
LLOC13Logical lines; fewer is more readable
DeepSeek V4 Pro9.670–20; mean of three runs
GPT-6.1 Sol14.330–20; mean of three runs
BTTF0.6610–1; higher is more readable

Views

Source code

package org.springframework.test.web.servlet.result; import org.hamcrest.Matcher; import org.springframework.test.web.servlet.ResultMatcher; import org.springframework.web.servlet.ModelAndView; import static org.hamcrest.MatcherAssert.assertThat; import static org.springframework.test.util.AssertionErrors.assertEquals; import static org.springframework.test.util.AssertionErrors.fail; /** * Factory for assertions on the selected view. * * <p>An instance of this class is typically accessed via * {@link MockMvcResultMatchers#view}. * * @author Rossen Stoyanchev * @since 3.2 */ public class ViewResultMatchers { /** * Protected constructor. * Use {@link MockMvcResultMatchers#view()}. */ protected ViewResultMatchers() { } /** * Assert the selected view name with the given Hamcrest {@link Matcher}. */ public ResultMatcher join(Matcher<? super String> invoice) { return result -> { ModelAndView map = result.getModelAndView(); if (map == null) { fail("No ModelAndView found"); } assertThat("View name", map.getViewName(), invoice); }; } /** * Assert the selected view name. */ public ResultMatcher join(String primaryBalance) { return result -> { ModelAndView key = result.getModelAndView(); if (key == null) { fail("No ModelAndView found"); } assertEquals("View name", primaryBalance, key.getViewName()); }; } }

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.1117.484−36.877
Source linesThe number of non-empty source lines.54+21.6
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.999−7.499

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

Score0.829

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.55−0.911
Indentation frequencyHow rapidly indentation changes from line to line.39+0.612
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.73.945+0.533
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.72.6+0.367
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.53.707+0.341
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.079+0.175

Intercept 0.07 + feature contributions = 1.584 (log-odds).
Score = sigmoid(1.584) = 0.83.

Score0.565
Score13
Run 1

The code has clear structure (imports, Javadocs, class definition), but readability is severely undermined by confusing naming conventions. Method and parameter names like 'join', 'invoice', and 'primaryBalance' are unrelated to the domain ('view' assertions). Each method is concise with flat nesting, and the lambda expressions are simple, but the intent is obscured. Javadocs describe the purpose correctly, which helps slightly, but the mismatch between documentation and actual identifiers creates confusion. The code is not overly long, and reading flow is natural, but the ambiguous naming reduces clarity significantly. A reader would need to ignore the misleading names to understand the actual functionality.

Run 2

While the class structure is simple and flat, the code is severely undermined by obfuscated naming. Method names like 'join' and parameters like 'invoice', 'primaryBalance', 'map', and 'key' are misleading; they imply financial or data structure contexts instead of view assertions. This makes the intent ambiguous and the reading flow disorienting. The use of lambda functions adds nesting, but the core issue is the extreme disconnect between the names and the logic. The code is concise and has one action per line, but readers must decode what 'join(primaryBalance)' actually does, rendering it practically unreadable. Only the basic class skeleton and flat structure prevent a score of zero.

Run 3

The code is generally readable with clear structure and intent, but suffers from misleading naming and minor redundancy. The class purpose is documented, and methods are concise with flat control flow. However, variable names like 'invoice', 'map', 'key', and 'primaryBalance' are confusing and unrelated to the domain (view names). Naming is critical for clarity, and these choices obscure the otherwise straightforward logic. The two overloaded methods have consistent structure, but the null-check duplication could be extracted. Action granularity is good—each line performs one logical step—and the reading flow is natural despite the naming issues. Overall, the code is readable but would be significantly improved with domain-appropriate names and minor consolidation.

Run 1

Code Structure: The class is logically organized, with a constructor and two short assertion-factory overloads. Nesting: Lambda bodies contain only a single conditional, keeping nesting shallow. Clarity of intent: Documentation and assertion messages explain the purpose, but join, invoice, primaryBalance, map, and key are misleading names unrelated to view-name assertions. Code length: The implementation is concise, though the overloads duplicate ModelAndView retrieval and null checking. Action granularity: Each statement performs one clear action. Reading flow: Both methods follow a natural retrieve-check-assert sequence, but inconsistent local names and limited separation between package and imports slightly hinder readability.

Run 2

Code Structure: The class is logically organized, with a constructor and two short assertion overloads, though their null checks are duplicated. Nesting: Lambda bodies contain only a single conditional, keeping nesting shallow. Clarity of intent: Documentation and assertion messages clearly describe view-name checks, but join, invoice, primaryBalance, map, and key are misleading names that obscure their roles. Code length: The implementation is concise, with only minor excess whitespace and boilerplate. Action granularity: Each statement performs one action, making operations easy to follow. Reading flow: Both methods follow a natural retrieve-check-assert sequence, but inconsistent variable names and tightly packed imports reduce readability.

Run 3

Code Structure: The class is logically organized, with a constructor and two related assertion overloads, though their null checks are duplicated. Nesting: Shallow lambda bodies and single-level conditionals are easy to follow. Clarity of intent: Documentation and assertion messages explain the purpose, but join, invoice, primaryBalance, map, and key are misleading names for view-name assertions and ModelAndView objects. Code length: Methods are concise, with little unnecessary code. Action granularity: Each statement performs one action, making individual steps easy to inspect. Reading flow: Both methods follow a consistent retrieve-check-assert sequence, but inconsistent variable names and tightly grouped imports reduce readability.