Module: Laser

Defined in:
lib/laser.rb,
lib/laser/runner.rb,
lib/laser/scanner.rb,
lib/laser/warning.rb,
lib/laser/version.rb,
lib/laser/rake/task.rb,
lib/laser/types/types.rb,
lib/laser/analysis/sexp.rb,
lib/laser/analysis/arity.rb,
lib/laser/analysis/scope.rb,
lib/laser/analysis/errors.rb,
lib/laser/analysis/visitor.rb,
lib/laser/analysis/bindings.rb,
lib/laser/support/frequency.rb,
lib/laser/analysis/comments.rb,
lib/laser/analysis/signature.rb,
lib/laser/analysis/laser_utils.rb,
lib/laser/analysis/method_call.rb,
lib/laser/warnings/line_length.rb,
lib/laser/analysis/annotations.rb,
lib/laser/analysis/control_flow.rb,
lib/laser/analysis/sexp_analysis.rb,
lib/laser/support/acts_as_struct.rb,
lib/laser/support/module_extensions.rb,
lib/laser/analysis/lexical_analysis.rb,
lib/laser/support/placeholder_object.rb,
lib/laser/analysis/protocol_registry.rb,
lib/laser/analysis/argument_expansion.rb,
lib/laser/analysis/bootstrap/bootstrap.rb,
lib/laser/analysis/bootstrap/laser_proc.rb,
lib/laser/analysis/override_safety_info.rb,
lib/laser/analysis/special_methods/send.rb,
lib/laser/support/inheritable_attributes.rb,
lib/laser/analysis/bootstrap/laser_class.rb,
lib/laser/analysis/bootstrap/laser_module.rb,
lib/laser/analysis/bootstrap/laser_method.rb,
lib/laser/analysis/bootstrap/laser_object.rb,
lib/laser/analysis/control_flow/simulation.rb,
lib/laser/analysis/control_flow/cfg_builder.rb,
lib/laser/analysis/control_flow/basic_block.rb,
lib/laser/annotation_parser/overload_parser.rb,
lib/laser/analysis/bootstrap/dispatch_results.rb,
lib/laser/annotation_parser/structural_parser.rb,
lib/laser/analysis/control_flow/alias_analysis.rb,
lib/laser/annotation_parser/annotations_parser.rb,
lib/laser/analysis/bootstrap/laser_module_copy.rb,
lib/laser/analysis/control_flow/cfg_instruction.rb,
lib/laser/analysis/control_flow/raise_properties.rb,
lib/laser/analysis/control_flow/unused_variables.rb,
lib/laser/analysis/control_flow/yield_properties.rb,
lib/laser/analysis/control_flow/lifetime_analysis.rb,
lib/laser/analysis/annotations/runtime_annotation.rb,
lib/laser/analysis/method_analysis/unused_methods.rb,
lib/laser/annotation_parser/useful_parsers_parser.rb,
lib/laser/analysis/bootstrap/laser_singleton_class.rb,
lib/laser/analysis/control_flow/control_flow_graph.rb,
lib/laser/analysis/control_flow/method_call_search.rb,
lib/laser/analysis/method_analysis/method_analysis.rb,
lib/laser/analysis/control_flow/constant_propagation.rb,
lib/laser/annotation_parser/class_annotations_parser.rb,
lib/laser/analysis/control_flow/unreachability_analysis.rb,
lib/laser/analysis/annotations/node_pointers_annotation.rb,
lib/laser/analysis/control_flow/static_single_assignment.rb,
lib/laser/analysis/control_flow/guaranteed_super_detection.rb,
lib/laser/analysis/annotations/comment_attachment_annotation.rb,
lib/laser/analysis/method_analysis/incorrect_predicate_method_detection.rb

Defined Under Namespace

Modules: ActsAsStruct, Analysis, InheritedAttributes, LexicalAnalysis, ModuleExtensions, Parsers, Rake, Types, Version Classes: AssignmentInConditionWarning, Comment, ConstantInForLoopError, DangerousOverrideError, DeadCodeWarning, DiscardedRHSError, DoubleIncludeError, DynamicSuperclassError, Error, ExtraBlankLinesWarning, ExtraWhitespaceWarning, FailedAliasError, FileWarning, Frequency, GenericLineLengthWarning, HashSymbol18Warning, HashSymbol19Warning, ImproperOverrideTypeError, IncompatibleArityError, InlineCommentSpaceWarning, LineWarning, MisalignedUnindentationWarning, MissingBlockError, NoMatchingTypeSignature, NoSuchMethodError, NotInMethodError, OperatorSpacing, OverrideWithoutSuperError, ParensOnDeclarationWarning, PlaceholderObject, ReopenedClassAsModuleError, ReopenedModuleAsClassError, RescueExceptionWarning, Runner, Scanner, SemicolonWarning, SexpErrorWarning, SuperclassMismatchError, TopLevelSimulationRaised, UnassignedLHSError, UncalledMethodWarning, UnnecessaryBlockError, UnusedVariableWarning, UselessDoubleQuotesWarning, Warning

Constant Summary

VERSION =
"0.5.0"
TESTS_ACTIVATED =
false
ROOT =
File.expand_path(File.dirname(__FILE__))
SETTINGS =
{load_path: []}

Class Method Summary (collapse)

Class Method Details

+ (Boolean) debug?

Returns:

  • (Boolean)


25
26
27
# File 'lib/laser.rb', line 25

def self.debug?
  SETTINGS[:debug]
end

+ (Object) debug_dotty(graph)



22
23
24
# File 'lib/laser.rb', line 22

def self.debug_dotty(graph)
  graph.dotty
end

+ (Object) debug_p(*args)



16
17
18
# File 'lib/laser.rb', line 16

def self.debug_p(*args)
  p *args if debug?
end

+ (Object) debug_pp(*args)



19
20
21
# File 'lib/laser.rb', line 19

def self.debug_pp(*args)
  pp *args if debug?
end

+ (Object) debug_puts(*args)



13
14
15
# File 'lib/laser.rb', line 13

def self.debug_puts(*args)
  puts *args if debug?
end

+ (Object) LineLengthCustomSeverity(size, severity)



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/laser/warnings/line_length.rb', line 92

def LineLengthCustomSeverity(size, severity)
  Laser.class_eval do
    if const_defined?("GenericLineLengthWarning_#{size}_#{severity}")
      return const_get("GenericLineLengthWarning_#{size}_#{severity}")
    end
    new_warning = Class.new(Laser::GenericLineLengthWarning)
    const_set("GenericLineLengthWarning_#{size}_#{severity}", new_warning)
    new_warning.line_length_limit = size
    new_warning.severity = severity
    new_warning.desc = Laser::GenericLineLengthWarning.desc
 new_warning.type(Laser::GenericLineLengthWarning.type)
    new_warning
  end
end

+ (Object) LineLengthMaximum(size)



107
108
109
# File 'lib/laser/warnings/line_length.rb', line 107

def LineLengthMaximum(size)
  (@table ||= {})[size] ||= LineLengthCustomSeverity(size, 8)
end

+ (Object) LineLengthWarning(size)



111
112
113
# File 'lib/laser/warnings/line_length.rb', line 111

def LineLengthWarning(size)
  (@table ||= {})[size] ||= LineLengthCustomSeverity(size, 3)
end

+ (Object) load_path



6
7
8
9
10
11
12
# File 'lib/laser.rb', line 6

def self.load_path
  SETTINGS[:load_path] + [ENV['LASER_RUBYPATH'], ENV['RUBYPATH']].map do |str|
    if str
      str.split(':')
    end
  end.compact.flatten + $:
end