You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shell: reflection_metaprogramming matches plain ${var} expansion (indirection marker is optional) and every $(...) -- 1,019 hits in 2,823 LOC on configure-helper.sh #2722
Found while attributing #2719's golden-master diff: with per-file dynamism (reflection_metaprogramming) feeding documentation risk, 15 of the crucible's 46 shell files jump ≥ 25 points, to ~99% -- configure-helper.sh reads 1,019 reflection hits in 2,823 coding lines, ansible-galaxy__runme.sh 149 in 333, xcrun_cache.sh 122 in 225.
The shell rule (gitgalaxy/standards/language_standards/languages/shell.py):
Two of its alternatives count ordinary shell as metaprogramming:
\$\{!?[a-zA-Z0-9_]+\} -- the !? makes the indirection marker optional, so plain ${var} matches. ${!var} (indirect expansion) is reflection; ${var} is a variable. This looks like a typo for \$\{![a-zA-Z0-9_]+\}.
Suggested fix: (1) is a one-character change (!? → !) and should be uncontroversial; for (2), keep eval, ${!var}, declare -n, source/. of a computed path, and the inline awk|sed|perl|python programs, and drop bare $(...)/backticks -- or move them to a signal that means "runs a command". reflection_metaprogramming is unplanted in keyword-rosetta, so the change is not gate-visible there; it is golden-master-visible (documentation and cognitive load on shell).
Found while attributing #2719's golden-master diff: with per-file dynamism (
reflection_metaprogramming) feeding documentation risk, 15 of the crucible's 46 shell files jump ≥ 25 points, to ~99% --configure-helper.shreads 1,019 reflection hits in 2,823 coding lines,ansible-galaxy__runme.sh149 in 333,xcrun_cache.sh122 in 225.The shell rule (
gitgalaxy/standards/language_standards/languages/shell.py):Two of its alternatives count ordinary shell as metaprogramming:
\$\{!?[a-zA-Z0-9_]+\}-- the!?makes the indirection marker optional, so plain${var}matches.${!var}(indirect expansion) is reflection;${var}is a variable. This looks like a typo for\$\{![a-zA-Z0-9_]+\}.\$\((?:...)\)and backticks -- every command substitution.test_shell_strict.pyL105 pinsoutput=$(date)as a positive, so this one is a deliberate decision by the rule's author; whether "runs a command" is the same thing as "dynamic dispatch a reader can't follow" is the question. On real shell it is one hit per ~3 lines, which is the language's vocabulary, not its dynamism -- the same shape as thecontrol_flow_ratiovocabulary leak in length leaks: func_internal_density, avg_func_loc and control_flow_ratio read file length with content and tier held equal (rosetta F.1 design pass) #2705.Suggested fix: (1) is a one-character change (
!?→!) and should be uncontroversial; for (2), keepeval,${!var},declare -n,source/.of a computed path, and the inlineawk|sed|perl|pythonprograms, and drop bare$(...)/backticks -- or move them to a signal that means "runs a command".reflection_metaprogrammingis unplanted in keyword-rosetta, so the change is not gate-visible there; it is golden-master-visible (documentation and cognitive load on shell).Related: #2716 (three-input model), #2719 (per-file dynamism), #2705 (vocabulary leaks).