Update coding style to match our own official coding guidelines

This commit is contained in:
mvandervoord
2020-03-18 19:16:58 -04:00
parent 9f8624a722
commit 67858837d1
27 changed files with 797 additions and 778 deletions
+33
View File
@@ -107,3 +107,36 @@ end
task :no_color do
$colour_output = false
end
################### CODING STYLE VALIDATION
namespace :style do
desc "Check style"
task :check do
report "\nVERIFYING RUBY STYLE"
report execute("rubocop ../lib ../examples ../config ../scripts --config ../vendor/unity/test/.rubocop.yml", true)
report "Styling Ruby:PASS"
end
desc "Fix Style of all C Code"
task :c do
run_astyle("../src/*.* ../extras/fixture/src/*.*")
end
desc "Attempt to Autocorrect style"
task :auto => ['style:clean'] do
report execute("rubocop ../lib ../examples ../config ../scripts --auto-correct --config ../vendor/unity/test/.rubocop.yml", true)
report "Autocorrected What We Could."
end
desc "Update style todo list"
task :todo => ['style:clean'] do
report execute("rubocop ../lib ../examples ../config ../scripts --auto-gen-config --config ../vendor/unity/test/.rubocop.yml", true)
report "Updated Style TODO List."
end
task :clean do
File.delete(".rubocop_todo.yml") if File.exists?(".rubocop_todo.yml")
end
end
task :style => ['style:check']
+12
View File
@@ -161,6 +161,18 @@ module RakefileHelpers
end
end
def run_astyle(style_what)
report "Styling C Code..."
command = "AStyle " \
"--style=allman --indent=spaces=4 --indent-switches --indent-preproc-define --indent-preproc-block " \
"--pad-oper --pad-comma --unpad-paren --pad-header " \
"--align-pointer=type --align-reference=name " \
"--add-brackets --mode=c --suffix=none " \
"#{style_what}"
execute(command, false)
report "Styling C:PASS"
end
def report_summary
summary = UnityTestSummary.new
summary.root = File.expand_path(File.dirname(__FILE__)) + '/'
+1 -1
View File
@@ -1035,7 +1035,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
{ :type=>"int", :name => "param8", :ptr? => false, :const? => true, :const_ptr? => false }],
:args_call => "param1, param2, param3, param4, param5, param6, param7, param8",
:contains_ptr? => true
}]
}].freeze
assert_equal(expected, @parser.parse("module", source)[:functions])
end