Sample

Scalabrio83

Human rating uses the original dataset scale.

DatasetScalabrino
Human3.44
Lines34

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
4.0Δ 35.9
Scalabrino0.1170–1; higher is more readable
8.5Δ 31.4
Dorn0.0120–1; higher is more readable
3.5Δ 36.4
Mi0.0120–1; higher is more readable
6.0Δ 33.9
LLOC31Logical lines; fewer is more readable
3.3Δ 36.7
DeepSeek V4 Pro6.330–20; mean of three runs
3.0Δ 36.9
GPT-6.1 Sol130–20; mean of three runs
5.0Δ 34.9
BTTF0.3930–1; higher is more readable
14.1Δ 25.9
Human3.441–5; original rating
39.9

Views

Source code

@Test @SuppressWarnings( {"UnusedAssignment", "UnusedDeclaration"}) public void testSelectExpressions() { createTestBaseData(); Session session = openSession(); Transaction txn = session.beginTransaction(); Human h = new Human(); h.setName( new Name( "Gavin", 'A', "King" ) ); h.setNickName("Oney"); h.setBodyWeight( 1.0f ); session.persist( h ); List results = session.createQuery("select 'found', lower(h.name.first) from Human h where lower(h.name.first) = 'gavin'").list(); results = session.createQuery("select 'found', lower(h.name.first) from Human h where concat(h.name.first, ' ', h.name.initial, ' ', h.name.last) = 'Gavin A King'").list(); results = session.createQuery("select 'found', lower(h.name.first) from Human h where h.name.first||' '||h.name.initial||' '||h.name.last = 'Gavin A King'").list(); results = session.createQuery("select a.bodyWeight + m.bodyWeight from Animal a join a.mother m").list(); results = session.createQuery("select 2.0 * (a.bodyWeight + m.bodyWeight) from Animal a join a.mother m").list(); results = session.createQuery("select sum(a.bodyWeight + m.bodyWeight) from Animal a join a.mother m").list(); results = session.createQuery("select sum(a.mother.bodyWeight * 2.0) from Animal a").list(); results = session.createQuery("select concat(h.name.first, ' ', h.name.initial, ' ', h.name.last) from Human h").list(); results = session.createQuery("select h.name.first||' '||h.name.initial||' '||h.name.last from Human h").list(); results = session.createQuery("select nickName from Human").list(); results = session.createQuery("select lower(nickName) from Human").list(); results = session.createQuery("select abs(bodyWeight*-1) from Human").list(); results = session.createQuery("select upper(h.name.first||' ('||h.nickName||')') from Human h").list(); results = session.createQuery("select abs(a.bodyWeight-:param) from Animal a").setParameter("param", new Float(2.0)).list(); results = session.createQuery("select abs(:param - a.bodyWeight) from Animal a").setParameter("param", new Float(2.0)).list(); results = session.createQuery("select lower(upper('foo')) from Animal").list(); results = session.createQuery("select lower(upper('foo') || upper('bar')) from Animal").list(); results = session.createQuery("select sum(abs(bodyWeight - 1.0) * abs(length('ffobar')-3)) from Animal").list(); session.delete(h); txn.commit(); session.close(); destroyTestBaseData(); }

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.2168.052−71.546
Source linesThe number of non-empty source lines.34+13.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.93−7.395

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

Score0.117

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.173.941−3.702
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.1+1.001
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Indentation frequencyHow rapidly indentation changes from line to line.1−0.703
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.34−0.359
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.09+0.063
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.32.566+0.045

Intercept 0.07 + feature contributions = -4.389 (log-odds).
Score = sigmoid(-4.389) = 0.012.

Score0.012
Score31
Run 1

The code has a clear overall structure (setup, execute, teardown) but suffers from severe readability issues. The test method has a single responsibility but is overloaded with 20+ similar query assertions, making it unnecessarily long and repetitive. Nesting is minimal, which is good, but clarity of intent is weak because there are no comments explaining what specific functionality each query tests. Multiple actions are packed into many lines (e.g., query creation, parameter binding, and list execution all on one line). Reading flow is natural but monotonous. The code would benefit from extracting helper methods, grouping related test cases, and breaking up complex query strings into separate lines or constants for better readability.

Run 2

The code is extremely unreadable primarily due to repetitive long query strings assigned to the same variable, excessive line lengths, and lack of logical grouping. The structure is flat but tangled: every query is jammed into a single method with no helper methods, comments, or separation by intent. Nesting is acceptable but the method body is monolithic. Clarity of intent is poor — the purpose is only vaguely clear and no distinction is made between test cases. Code length is unnecessarily bloated due to repeated verbose query strings. Action granularity is violated because multiple steps (query creation, parameter setting, listing) are chained on one line. Reading flow is broken by uniform repetition and no whitespace between logical blocks. The method uses raw types and suppresses warnings, further reducing clarity. Overall, the test is hard to scan, maintain, or extend.

Run 3

The code has a clear overall structure (setup, operations, teardown), but readability is severely impacted by repetitive, extremely long lines that perform multiple actions (query creation, execution, and assignment). Nesting is minimal, which is positive, but the test name and string-heavy queries make intent unclear without domain knowledge. Many lines exceed reasonable length, harming scanning and comprehension. Reading flow is monotonous and difficult to follow. The repeated reassignment of the same variable across many unrelated queries obscures what is being tested. Overall, the code is functional but not optimized for human readability.

Run 1

Code Structure: Setup, query execution, and cleanup follow a logical order, but many unrelated expression cases are grouped without labels or separation. Nesting: The method is flat and easy to scan. Clarity of intent: The method name indicates expression testing, but repeatedly overwriting unused results and omitting assertions leave expected behavior unclear; short names such as h and txn provide limited context. Code length: Moderate overall, but repetitive query statements and long SQL strings make the method visually dense. Action granularity: Most lines represent one operation, although query creation, parameter binding, and execution are sometimes chained together. Reading flow: The lifecycle proceeds naturally from initialization to cleanup, but inconsistent spacing and an uninterrupted sequence of queries hinder comprehension.

Run 2

Code Structure: Setup, query execution, and cleanup are logically ordered, but the many expression tests lack grouping or helper methods. Nesting: The method is flat and easy to traverse. Clarity of intent: The method name and queries indicate expression testing, but repeatedly overwriting unused results without assertions leaves expected outcomes unclear; abbreviated variable names add minor ambiguity. Code length: Individual operations are concise, but the repetitive query block makes the method lengthy and monotonous. Action granularity: Most lines represent one operation, although chained query creation, parameter binding, and execution compress several steps onto a line. Reading flow: Execution proceeds naturally from initialization to cleanup, but long query strings, inconsistent spacing, and absent visual separation between query categories reduce scanability.

Run 3

Code Structure: Setup, query execution, and cleanup follow a logical sequence, but the query cases lack grouping or descriptive labels. Nesting: The method is flat and easy to navigate. Clarity of intent: The test name and query strings communicate expression testing, but repeatedly overwriting unused results without assertions leaves expected outcomes unclear. Code length: The method is manageable, though repetitive query boilerplate and long lines make scanning harder. Action granularity: Most statements occupy separate lines, but chained query creation, parameter binding, and execution combine several operations. Reading flow: The lifecycle is natural, yet the uninterrupted series of similar queries, terse variable names, and inconsistent spacing reduce readability.