Sha256: ac1bdde93d2aa6b91f18391bafd7e3be7b6906bdfae2ffd7caad4e39738ee578

Contents?: true

Size: 1.58 KB

Versions: 15

Compression:

Stored size: 1.58 KB

Contents

require 'blocks/compile'

module Bake
  module Blocks
    class Lint < Compile
  
      def initialize(block, config, referencedConfigs, tcs)
        super(block,config, referencedConfigs, tcs)
      end
  
      def execute
        Dir.chdir(@projectDir) do
          compiler = @tcs[:COMPILER][:CPP]
          calcSources
          
          noFilesToLint = (@source_files.length == 0)
          
          if Bake.options.lint_min >= 1 and Bake.options.lint_min >= @source_files.length
            noFilesToLint = true 
          end
          
          if Bake.options.lint_max >= 0 and Bake.options.lint_max < Bake.options.lint_min
            noFilesToLint = true 
          end
                    
          if noFilesToLint
            Bake.formatter.printInfo("No files to lint", @config)
          else
            @source_files = @source_files[Bake.options.lint_min..Bake.options.lint_max]    
            
            cmd = [compiler[:COMMAND]]
            cmd += compiler[:COMPILE_FLAGS]
              
            cmd += @include_array[:CPP]
            cmd += @define_array[:CPP]
              
            cmd += @tcs[:LINT_POLICY]
            
            cmd += @source_files
                   
            printCmd(cmd, "Linting #{@source_files.length} file(s)...", nil, false)
            success, consoleOutput = ProcessHelper.run(cmd, false)
            process_result(cmd, consoleOutput, compiler[:ERROR_PARSER], "Linting...", nil, success)
          end
        end
      end  
      
      def clean
      end
      
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
bake-toolkit-2.10.1 lib/blocks/lint.rb
bake-toolkit-2.10.0 lib/blocks/lint.rb
bake-toolkit-2.9.2 lib/blocks/lint.rb
bake-toolkit-2.9.1 lib/blocks/lint.rb
bake-toolkit-2.9.0 lib/blocks/lint.rb
bake-toolkit-2.8.0 lib/blocks/lint.rb
bake-toolkit-2.7.0 lib/blocks/lint.rb
bake-toolkit-2.5.0 lib/blocks/lint.rb
bake-toolkit-2.4.4 lib/blocks/lint.rb
bake-toolkit-2.4.3 lib/blocks/lint.rb
bake-toolkit-2.3.4 lib/blocks/lint.rb
bake-toolkit-2.2.2 lib/blocks/lint.rb
bake-toolkit-2.1.1 lib/blocks/lint.rb
bake-toolkit-2.1.0 lib/blocks/lint.rb
bake-toolkit-2.0.10 lib/blocks/lint.rb