Sample

int-cfe32a294103-I12

Inline all eligible single-use intermediate local variables

Matched original source

Lines54

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.8330–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 Pro18.670–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.780–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 name(Matcher<? super String> matcher) { return result -> { ModelAndView mav = result.getModelAndView(); if (mav == null) { fail("No ModelAndView found"); } assertThat("View name", mav.getViewName(), matcher); }; } /** * Assert the selected view name. */ public ResultMatcher name(String expectedViewName) { return result -> { ModelAndView mav = result.getModelAndView(); if (mav == null) { fail("No ModelAndView found"); } assertEquals("View name", expectedViewName, mav.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.1111.713−36.687
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.984−7.476

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

Score0.833

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.964+0.532
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.813+0.342
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.079+0.177

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

Score0.565
Score13
Run 1

The code demonstrates excellent readability. Structure is logical with clear package, imports, and class organization. Nesting is minimal - only a single-level lambda with a null check. Intent is unambiguous through descriptive method names and Javadoc. Code length is concise, avoiding unnecessary boilerplate. Action granularity is appropriate - each assertion is on its own line. Reading flow is natural, following a predictable pattern. Minor deductions: protected constructor could be private, and the null check is slightly repetitive across methods, but these are negligible.

Run 2

The code is highly readable. It demonstrates excellent structure with clear package and import organization. The class has a single responsibility with well-documented public methods. Nesting is minimal, limited to simple lambda expressions containing straightforward conditional checks. Each method's intent is immediately clear from its name and Javadoc. The code is concise, avoiding unnecessary boilerplate while maintaining completeness. Actions are properly granular, with one logical operation per line within the lambdas. Reading flow is natural, with protected constructor clearly separated and methods ordered logically. The use of static imports enhances readability by reducing verbosity without sacrificing clarity.

Run 3

The code is highly readable. Structure is logical with clear separation between the matcher factory methods. Nesting is minimal, with only a single level inside lambda expressions. Intent is explicit through descriptive method names and Javadoc comments. Code length is concise — no unnecessary boilerplate. Action granularity is well-balanced: variable assignment, null checks, and assertions each occupy their own line. Reading flow is natural, following a consistent pattern in both overloaded methods. Minor points deducted for reliance on static imports that may obscure the origin of assertion utilities, but overall this is excellent Spring Framework style code.

Run 1

Code Structure: Logically organized into a documented factory class with two clear assertion overloads. Nesting: Shallow lambda bodies contain only a single conditional, making control flow easy to follow. Clarity of intent: Descriptive method parameters, Javadoc, and assertion messages clearly communicate purpose; the abbreviation 'mav' is slightly less explicit than 'modelAndView'. Code length: Concise overall, though the repeated ModelAndView retrieval and null check introduce minor duplication. Action granularity: Each statement performs one distinct action. Reading flow: Both methods follow the same natural sequence—retrieve, validate, assert. Minor formatting issues, including crowded imports and extra blank lines, slightly reduce polish.

Run 2

Code Structure: A focused class with two logically grouped overloads and a clearly documented constructor. Nesting: Shallow lambda bodies contain only a simple null check. Clarity of intent: Descriptive method signatures, Javadoc, and assertion messages make the purpose obvious; the abbreviation 'mav' is slightly less explicit than 'modelAndView'. Code length: Concise overall, though the retrieval and null-check logic is duplicated between overloads. Action granularity: Each statement performs one clear action on its own line. Reading flow: Both methods follow the same natural sequence—retrieve the model and view, check its presence, then assert the view name. Minor spacing inconsistencies around imports and extra blank lines slightly reduce polish.

Run 3

Code Structure: A focused class with two clearly organized overloads and helpful documentation. Nesting: Shallow lambda bodies contain only a single null-check conditional. Clarity of intent: Method names, parameter names, and assertion messages make the purpose explicit; 'mav' is slightly less descriptive than 'modelAndView'. Code length: Concise overall, though the ModelAndView retrieval and null check are duplicated. Action granularity: Each statement performs one clear action on its own line. Reading flow: Both methods follow the same natural sequence of retrieval, validation, and assertion. Minor formatting issues, such as ungrouped imports and extra blank lines, slightly reduce polish without hindering comprehension.