Class: RemLint::Rules::IncludePath
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::IncludePath
- Defined in:
- lib/remlint/rules/include_path.rb
Overview
INCLUDE and SYSINCLUDE paths that do not mean what they look like.
TWO KEYWORDS, TWO BASE DIRECTORIES. INCLUDE resolves a relative path
against the working directory, not against the directory of the file
doing the including. The manual calls this a mistake kept for
compatibility, and DO is the keyword that resolves relative to the
file. So INCLUDE defs.rem works when you run Remind from the directory
the script lives in and fails from anywhere else -- from cron, most
memorably.
SYSINCLUDE with an absolute path is the mirror image: for an absolute
path it is simply INCLUDE, so the keyword reads as though it pointed
into the system include directory when it does not.
A path built from an expression -- [$SysInclude]/ansitext.rem, which is
how examples/ansitext does it -- is left alone, because what it
resolves to is not decidable here.
Constant Summary collapse
- ABSOLUTE =
%r{\A/}
Constants inherited from RemLint::Rule
Instance Attribute Summary
Attributes inherited from RemLint::Rule
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RemLint::Rule
all, enabled_by_default?, find, inherited, #initialize, rule_name, #rule_name, #run
Constructor Details
This class inherits a constructor from RemLint::Rule
Class Method Details
.default_severity ⇒ Object
27 28 29 |
# File 'lib/remlint/rules/include_path.rb', line 27 def self.default_severity "warning" end |
.description ⇒ Object
31 32 33 34 |
# File 'lib/remlint/rules/include_path.rb', line 31 def self.description "INCLUDE with a relative path, where DO resolves relative to the file, " \ "or SYSINCLUDE with an absolute one." end |
Instance Method Details
#check ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/remlint/rules/include_path.rb', line 36 def check document.code_commands.each do |command| path = literal_path(command) if path report(command, path) end end end |