Skip to content

Commit

Permalink
Added clause to ignore cop UnlessDefinedRequire in rubocop.yml
Browse files Browse the repository at this point in the history
Signed-off-by: smriti <sgarg@msystechnologies.com>
  • Loading branch information
msys-sgarg committed Feb 2, 2022
1 parent 3f2200c commit e02ba54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/supermarket/engines/fieri/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ Layout/MultilineOperationIndentation:
EnforcedStyle: aligned
Style/SymbolArray:
EnforcedStyle: brackets
Chef/Ruby/UnlessDefinedRequire:
Enabled: false
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
require "mixlib/shellout"
require "dotenv-rails"
Dotenv.load(".env")
require "shellwords" unless defined?(Shellwords)
require "shellwords"

module CookstyleHelpers
def self.process_artifact(path)
Expand All @@ -10,7 +10,7 @@ def self.process_artifact(path)
shell_out.run_command
parse_cookstyle_output(shell_out.stdout)
rescue StandardError => e
raise "Error in processing Artifact #{e.message}"
raise "New Error in processing Artifact #{e.message} and #{e}"
end

# "COP_NAME":"MESSAGE":"file_name:line=line_no,col=col_no"
Expand All @@ -19,11 +19,10 @@ def self.parse_cookstyle_output(cookstyle_output)
offenses_arr = JSON.parse(cookstyle_output)["files"].map { |h|
h["offenses"]\
.each { |a| a.merge!("file" => h["path"]) }
} \
.flatten.sort_by { |hsh| hsh["cop_name"] }\
}.flatten.sort_by { |hsh| hsh["cop_name"] }\
.each { |a|
status << "#{[a["cop_name"], a["message"],\
a["file"], a["location"]["line"]].join(": ")}\n"
a["file"], a["location"]["line"]].join(": ")}\n"
}

[status, offenses_arr.size > 0]
Expand Down

0 comments on commit e02ba54

Please sign in to comment.