Class: Renegade::PreCommit
- Inherits:
-
Object
- Object
- Renegade::PreCommit
- Defined in:
- lib/renegade/pre_commit.rb
Overview
Run linters
Instance Method Summary collapse
- #handle_errors ⇒ Object
-
#initialize ⇒ PreCommit
constructor
A new instance of PreCommit.
- #run(files, branch_name, markers) ⇒ Object
Constructor Details
#initialize ⇒ PreCommit
Returns a new instance of PreCommit.
11 12 13 14 15 16 17 18 |
# File 'lib/renegade/pre_commit.rb', line 11 def initialize Renegade::Status.hook_start('pre-commit') @scss_lint = Renegade::Linters.new('SCSS Lint', '.scss', 'scss-lint') @eslint = Renegade::Linters.new('ESLint', '.js', 'eslint') @branch_name = Renegade::BranchName.new @conflict_markers = Renegade::ConflictMarkers.new @protected_files = Renegade::ProtectedFiles.new end |
Instance Method Details
#handle_errors ⇒ Object
33 34 35 36 37 38 |
# File 'lib/renegade/pre_commit.rb', line 33 def handle_errors Renegade::HandleErrors.handle_warnings(@branch_name.warnings + @protected_files.warnings) Renegade::HandleErrors.handle_errors(@scss_lint.errors + @eslint.errors + @conflict_markers.errors) end |
#run(files, branch_name, markers) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/renegade/pre_commit.rb', line 20 def run(files, branch_name, markers) unless files.empty? files = files.split("\n") @scss_lint.run(files) @eslint.run(files) @branch_name.run(branch_name) @conflict_markers.run(markers) @protected_files.run(files) end handle_errors end |