Sha256: 949c0538d5412f2aef8f4986e109a02cfbb9d6e90a3024309f67f48a8a457613
Contents?: true
Size: 996 Bytes
Versions: 2
Compression:
Stored size: 996 Bytes
Contents
#!/usr/bin/env ruby require 'json' # # ruby-author-warnings # # This script outputs the authors of the lines of code that # have been flagged by Rubocop as having too high of a complexity. # # Three metrics are used to determine complexity: # # - ABC Size # - Cyclomatic Complexity # - Perceived Complexity # # Each line of code can trigger one or more of these metrics. # Each triggered line is listed as a separate warning. # RUBOCOP_WARNINGS = `rubocop --format json --force-default-config --only Metrics/AbcSize,Metrics/BlockLength,Metrics/BlockNesting,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity` LOCATIONS = JSON .parse(RUBOCOP_WARNINGS)['files'] .reject{ |f| f['offenses'].empty? } .map{ |f| f['offenses'] .map{|o| { path: f['path'], begin: o['location']['start_line'], end: o['location']['last_line'] }}} .flatten LOCATIONS.each do |location| puts `line-authors #{location[:path]} #{location[:begin]} #{location[:end]}` end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
quality_report-1.1.0 | exe/ruby-author-warnings |
quality_report-1.0.0 | exe/ruby-author-warnings |