Repository navigation
- Upgrading reindexes once (store v75): the first command after
upgrading rebuilds the index, with nothing to run. A script reading
--dead'ssummary.tiersnow sees methods undertest-only(below).
Added
-
Haml templates are read. Every
*.hamlin a checkout is indexed for
the Ruby it runs, at the template's own lines and columns, as an ERB
template is: a script line's code (- x,= x,!= x,&= x,~ x, a
tag's= x, and the lines a trailing comma continues it onto), a tag's
attribute hash and(name=value)values, each#{…}in text and in a
filter, and a:rubyfilter's body. A call in one underapp/views/runs
on the view context (resolved_via: view), so--defand--refs
answer there, and--deadcounts it as a call rather than "named in a
view (…), which is not read" — that caveat stays for Slim, Jbuilder and
Builder. Anif/elsif/else/unlesschain is read flat, its
conditions and branches each a statement. Adoblock's parameters are
in scope inside it and not after it, except where two blocks end at the
left margin at once, which leaves room to close only one: there the
outer block's parameters stay in scope over the Ruby up to its close.
The language server reads.hamldocuments and says so
(experimental.trekr.templateslists"haml"), and the Claude Code
plugin starts it for.hamlfiles. The VS Code extension's Haml support
ships separately (see its changelog). -
--deadlists a method only specs and tests call astest-only, as
it already did a class, however many calls they write. Such a method was
missing when the specs called it more than once, andsingle-callerwhen
once. The reason says how many calls and where the first is, and a method
row'stest_refscounts them, as a constant row's does. A test is a file
under aspec/,test/ortests/directory at the checkout's root or
a nested package's (plugins/chat/spec/), not one insidelib/or
app/. A method that overrides another, or a hook Ruby calls by name,
keeps the tier it would have without the tests, as does one a route or a
library's convention reaches (a Pundit predicate), and a spec's own
helper is nevertest-only. -
--deadsays when a row is reached from outside the repo. Such a row
keeps its tier, is gradedlower, and names its kind of entry point
(entry_pointin JSON); its caveat names the evidence that settles it.route: a routed controller action, or a controller only routes name
(these wereconvention-only, clear). Settle it with request logs or
APM.job: an Active Job or Sidekiq job class nothing outside the tests
names. Settle it with job metrics or logs.api: a library's public API — a public or protected method (RDoc
documents protected ones), a class or module, or a constant bound to a
constant path, resolved or not (Worker = Job,Client = OtherGem::Client), or to aDeprecatedConstantProxy, in a library's
lib/. Any other value constant is not API. Settle it with the gem's
dependents or usage data.
A library's
lib/is the checkout's own, or one beside a nested
*.gemspec(protobuf'sruby/), in a checkout that is no app. An app has
aconfig/application.rbat its root, gemspec or not, or aconfig.ru
or anapp/without a root*.gemspec— so an engine gem'sapp/or a
gem's democonfig.rudoes not make one. A library needs no gemspec: a
Hoe gem such as minitest has none until release. An app's own engine is
not a library.What its author marks internal is not API:
:nodoc:,@api private,
@private(a YARD tag opening a comment line),Internal:(a TomDoc
status opening the comment's first line), a leading underscore, or
private_constant. Each mark reaches as far as its tool reads it:- A
:nodoc:covers its own class and the methods its body defines, as
RDoc reads it, so Rails'module ActiveSupport # :nodoc:hides nothing
nested in it. In that body, an own-line# :doc:at a method's
indentation uncovers the method, unless an own-line# :nodoc:at that
indentation comes between (Rails'Dependencies.run_interlock). :nodoc: alland@api privatealso cover what their marked opening
holds, but not another opening of the class;private_constantcovers
what is nested anywhere.- A method's own
@api publicoverrides its class's@api private, as
YARD reads it. - A private or underscored method marked
:doc:is API, as RDoc
documents it (Rails'RequestForgeryProtection#verified_request?). - A method under a bare
module_functionis API by its public singleton
copy, as one named bymodule_function :xis, until a bareprivate
ends that mode.
-
An RSpec predicate matcher is a reference to the predicate it calls.
expect(page).to have_event_count(1)callshas_event_count?, and
be_visibleandbe_an_admincallvisible?andadmin?.be_exist
callsexist?when the subject has it, elseexists?, as RSpec's
method_missingdoes.--refslists each such call (called_asnames
the matcher), the editor's Find References lists it too, and--dead
counts it, so a page object's predicate a spec asserts this way is no
longerunreferenced. Confirmed whereexpect(x)types its subject,
possible where it does not (be_existthen for bothexist?and
exists?); a matcher RSpec or the spec defines (be_within) calls no
predicate. -
--deadlists a Minitest or Test::Unit test asconvention-only,
by the test runner, rather thanunreferenced: a publictest_method
of a class under a test directory that inheritsMinitest::Testor its
kin, or, where its ancestors are not all indexed, is in a test file
(test_*.rb,*_test.rb) undertest/. A class in a test file that is
no test case (a fake, a stub controller) runs notest_method. -
--deadreads an extensionless Ruby script (exe/tool,bin/x),
which trekr does not index, for the names it writes: a row one names
keeps its tier and islower, "named in a script (exe/tool), which is
not read", as a Slim view's word grades it. -
--deadreads an interpolated string sent by name,
TopicQuery.new(opts).public_send("list_#{filter}")orrule = "validate_#{name}"; public_send(rule), as it reads:"list_#{filter}".
A method whose name fits, in the receiver's class, its ancestors, its
subclasses or theirs, says "a name of its shape is sent at runtime" and
is gradedlower. A string sent to a variable
(row.public_send("total_#{kind}")) is left alone.
Changed
--deadgrades a class, module or constant rowclearwhen nothing in
the checkout could reach it by a built name, instead ofloweron
every row. A row islowerwhen the checkout looks up a name computed
whole (name.constantize,Object.const_get(x),klass.const_get(x)),
and its caveat says where, or when a namespace, shape or listing already
caveated reaches it. Apps nearly always have such a lookup, so their rows
staylower; a gem without one now readsclear.--deadgrades a module's methodlowerwhen its name is called on a
class that lacks it, naming the call: "called on TopicQuery (…), where
trekr finds no such method; a module mixed in at runtime may supply it".
A module prepended from a block (a plugin'safter_initialize) is no
edge trekr records, so such a method wasunreferenced, clear, though
that call runs it.
Fixed
- A bare
private,protectedorpublicendsmodule_function's
mode, as in Ruby: a method after one is no longer recorded as a public
singleton copy plus a private instance method, so--symbolsand
--defgive it the visibility its toggle says, and no singleton method
Ruby never defines.private def x,public def xandprotected def xare no toggle: they keep the mode's public singleton copy, and the
instance method takes the visibility written. - A
definTarget.class_eval do … endinside another class or method
isTarget's, as it already was at the top level. It was recorded on
the class around the block, so calls to it were residue and--refs 'Target#x'saidno_such_method.Target.instance_eval do def xmakes
Target.x. Thedef's owner is found as Ruby findsTarget, through
the enclosing class's ancestors too, and an alias (Gizmo = Gadget) is
followed. A constant written in a qualified receiver's block
(Faker::Lorem.instance_eval { X = 1 }) is scoped like Ruby's: top-level
there, not the receiver's. --deadno longer lists a class or module that a spec or test file
defines and the tests use astest-only: it is test code in use, as a
spec's own helper method is. One nothing uses is stillunreferenced.--deadno longer takes atest/orspec/directory insidelib/or
app/for tests: rack-test's library islib/rack/test/, so a constant
only it used wastest-only, and a name it builds and sends was not read.--deadno longer says a method "callssuper, so it overrides a method
trekr has not indexed", and grades itlower, when thesuperbelongs
to adefnested in its body or to a block it hands todefine_method
ordefine_singleton_method(send(:define_method, :x) { super() }).--deadcounts a test's reference to a class once. A class written with
a compact namespace nothing else defines (class Scheduler::X) had each
reference counted twice intest_refsand its "referenced only from
tests (N, …)" reason.