netsoft-danger 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Dangerfile +3 -111
- data/lib/netsoft-danger/version.rb +1 -1
- metadata +6 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: '0981c81d0ae817b555ad494429d321ca25193ae0084b61fa1205a934ff3f6372'
         | 
| 4 | 
            +
              data.tar.gz: '0991c0da27a9809734a3c5d6366d726bba8308fb33165f767645174676d60d4a'
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8537ad5a81b1cd8e028a5af2ae90fe1309d0794254a94b32b38b5560e842290940c77655e653774d718dcb6ff0802b332b0c47ed43d23c2f112886b29fe18fdd
         | 
| 7 | 
            +
              data.tar.gz: c5c57afe569726883d54732717357415c76e9334f8f1c2e13cab3fdf6f7d8593353986da1510a9c685138ea754f6da1f20aeeadfade307d6ba84758b67ecf84d
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
| 9 9 | 
             
            ### Changed
         | 
| 10 10 | 
             
            ### Fixed
         | 
| 11 11 |  | 
| 12 | 
            +
            ## [0.7.0]
         | 
| 13 | 
            +
            ### Changed
         | 
| 14 | 
            +
            - remove checks for migration and gemfile prefixes in commit messages
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            ## [0.6.0]
         | 
| 17 | 
            +
            - remove the focus and print checks from the ruby danger (now handled by rubocop)
         | 
| 18 | 
            +
             | 
| 12 19 | 
             
            ## [0.5.0]
         | 
| 13 20 | 
             
            ### Changed
         | 
| 14 21 | 
             
            - updated danger to 8.x
         | 
    
        data/Dangerfile
    CHANGED
    
    | @@ -12,14 +12,6 @@ def toggle_label(github, label, should_set) | |
| 12 12 | 
             
              end
         | 
| 13 13 | 
             
            end
         | 
| 14 14 |  | 
| 15 | 
            -
            # Don't let testing shortcuts get into master by accident
         | 
| 16 | 
            -
            if Dir.exist?('spec')
         | 
| 17 | 
            -
              fail('fdescribe left in tests') if `grep -r -I -e '\\bfdescribe\\b' spec/ |grep -v 'danger ok' `.length > 1
         | 
| 18 | 
            -
              fail('fcontext left in tests') if `grep -r -I -e '\\bfcontext\\b' spec/ |grep -v 'danger ok' `.length > 1
         | 
| 19 | 
            -
              fail('ap left in tests') if `grep -r -I -e '\\bap\\b' spec/ | grep -v 'danger ok' `.length > 1
         | 
| 20 | 
            -
              fail('puts left in tests') if `grep -r -I -e '\\bputs\\b' spec/ | grep -v 'danger ok' `.length > 1
         | 
| 21 | 
            -
            end
         | 
| 22 | 
            -
             | 
| 23 15 | 
             
            if File.exist?('Gemfile')
         | 
| 24 16 | 
             
              if `grep -r -e "^ *gem 'hubstaff_[a-z]\\+" Gemfile | grep -e ",.\\+[a-zA-Z]" `.length > 1
         | 
| 25 17 | 
             
                fail('gemfile: Beta hubstaff_* gems are not allowed in master/production')
         | 
| @@ -36,110 +28,10 @@ if github.branch_for_head.start_with?('security') | |
| 36 28 | 
             
              toggle_label(github, 'security', true)
         | 
| 37 29 | 
             
            end
         | 
| 38 30 |  | 
| 39 | 
            -
            should_have_migration_label = false
         | 
| 40 | 
            -
             | 
| 41 31 | 
             
            git.commits.each do |c|
         | 
| 42 | 
            -
               | 
| 43 | 
            -
              has_migrations     = c.diff_parent.any? { |f| f.path =~ %r{db/migrate/} }
         | 
| 32 | 
            +
              has_migrations = c.diff_parent.any? { |f| f.path =~ %r{db/migrate/} }
         | 
| 44 33 | 
             
              has_schema_changes = c.diff_parent.any? { |f| f.path =~ %r{db/schema\.rb} }
         | 
| 45 | 
            -
              has_migration_msg  = c.message.match?(/\Amigration(\([A-Za-z]+\))?:/)
         | 
| 46 | 
            -
              no_schema_ok       = ENV['DANGER_NO_SCHEMA_OK'] || false
         | 
| 47 | 
            -
              if has_migrations || has_schema_changes
         | 
| 48 | 
            -
                unless has_migration_msg
         | 
| 49 | 
            -
                  fail 'migration: Schema migration commits needs to be tagged with (migration). e.g. migration(Module): ' + short
         | 
| 50 | 
            -
                end
         | 
| 51 | 
            -
                if has_migrations && !has_schema_changes && !no_schema_ok
         | 
| 52 | 
            -
                  fail 'migration: Please checkin your schema.rb changes with your migration' + short
         | 
| 53 | 
            -
                end
         | 
| 54 | 
            -
                if !has_migrations && has_schema_changes
         | 
| 55 | 
            -
                  warn 'migration: Please checkin your migrations with your schema.rb changes' + short
         | 
| 56 | 
            -
                end
         | 
| 57 | 
            -
                if c.diff_parent.any? { |f| f.path !~ %r{db/migrate/|db/schema\.rb} }
         | 
| 58 | 
            -
                  fail 'migration: Migration commit contains non-migration changes' + short
         | 
| 59 | 
            -
                end
         | 
| 60 | 
            -
             | 
| 61 | 
            -
                should_have_migration_label = true
         | 
| 62 | 
            -
              elsif has_migration_msg
         | 
| 63 | 
            -
                fail '[migration] Migration commit with no migrations!' + short
         | 
| 64 | 
            -
              end
         | 
| 65 | 
            -
             | 
| 66 | 
            -
              has_hubstaff_icon_changes = c.diff_parent.any? { |f| f.path =~ /hubstaff(icons|font)|fontcustom-manifest/ }
         | 
| 67 | 
            -
              if has_hubstaff_icon_changes
         | 
| 68 | 
            -
                if c.diff_parent.any? { |f| !(f.path =~ /hubstaff-(icons|font)/ || f.path =~ /fontcustom-manifest/) }
         | 
| 69 | 
            -
                  fail 'hubstaff-icons: Put hubstaff-icon changes into their own commit' + short
         | 
| 70 | 
            -
                end
         | 
| 71 | 
            -
              end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
              has_gemfile_changes = c.diff_parent.any? { |f| f.path =~ /Gemfile|gemspec/ }
         | 
| 74 | 
            -
              has_gemfile_msg     = c.message.match?(/\Agemfile(\([A-Za-z]+\))?:/)
         | 
| 75 | 
            -
              if has_gemfile_changes
         | 
| 76 | 
            -
                unless has_gemfile_msg
         | 
| 77 | 
            -
                  fail 'gemfile: Gemfile commits needs to be tagged with (gemfile). e.g. gemfile(Module): ' + short
         | 
| 78 | 
            -
                end
         | 
| 79 | 
            -
                if c.diff_parent.any? { |f| f.path !~ /Gemfile|gemspec/ }
         | 
| 80 | 
            -
                  fail 'gemfile: Gemfile commit contains non-gemfile changes' + short
         | 
| 81 | 
            -
                end
         | 
| 82 | 
            -
                if c.diff_parent.any? { |f| f.path == 'Gemfile.lock' }
         | 
| 83 | 
            -
                  unless `grep -E -- '^BUNDLED WITH\s*\n\s+(1\\.15\\.2|1\\.17\\.3)$' Gemfile.lock`.length > 1
         | 
| 84 | 
            -
                    fail('gemfile: Gemfile not bundled with bundler 1.15.2 or 1.17.3')
         | 
| 85 | 
            -
                  end
         | 
| 86 | 
            -
                end
         | 
| 87 | 
            -
              elsif has_gemfile_msg
         | 
| 88 | 
            -
                fail 'gemfile: Gemfile commit has no gemfile changes!' + short
         | 
| 89 | 
            -
              end
         | 
| 90 34 |  | 
| 91 | 
            -
               | 
| 92 | 
            -
               | 
| 93 | 
            -
              if has_package_changes
         | 
| 94 | 
            -
                unless has_package_msg
         | 
| 95 | 
            -
                  fail 'package: Package.json commits needs to be tagged with package. e.g package(Module): ' + short
         | 
| 96 | 
            -
                end
         | 
| 97 | 
            -
                if c.diff_parent.any? { |f| f.path !~ /package\.json|yarn\.lock/ }
         | 
| 98 | 
            -
                  fail 'package: Package.json commit contains non-package changes' + short
         | 
| 99 | 
            -
                end
         | 
| 100 | 
            -
              elsif has_package_msg
         | 
| 101 | 
            -
                fail 'package: Pacakge.json commit has no package changes!' + short
         | 
| 102 | 
            -
              end
         | 
| 103 | 
            -
            end
         | 
| 104 | 
            -
             | 
| 105 | 
            -
            toggle_label(github, 'run migration', should_have_migration_label)
         | 
| 106 | 
            -
             | 
| 107 | 
            -
            if ENV['CIRCLE_TOKEN']
         | 
| 108 | 
            -
              require 'open-uri'
         | 
| 109 | 
            -
             | 
| 110 | 
            -
              artifact_url = "https://circleci.com/api/v1.1/project/github/#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}/#{ENV['CIRCLE_BUILD_NUM']}/artifacts?circle-token=#{ENV['CIRCLE_TOKEN']}"
         | 
| 111 | 
            -
              artifacts    = JSON.parse(URI.parse(artifact_url).read).map { |a| a['url'] }
         | 
| 112 | 
            -
             | 
| 113 | 
            -
              jest        = artifacts.find { |artifact| artifact.end_with?('jest/index.html') }
         | 
| 114 | 
            -
              coverage    = artifacts.find { |artifact| artifact.end_with?('coverage/index.html') }
         | 
| 115 | 
            -
              rubocop     = artifacts.find { |artifact| artifact.end_with?('rubocop/report.html') }
         | 
| 116 | 
            -
              eslint      = artifacts.find { |artifact| artifact.end_with?('eslint/report.html') }
         | 
| 117 | 
            -
              brakeman    = artifacts.find { |artifact| artifact.end_with?('brakeman/report.html') }
         | 
| 118 | 
            -
              rspec_files = artifacts.select { |artifact| artifact =~ /rspec-(.+)\.html$/ }
         | 
| 119 | 
            -
             | 
| 120 | 
            -
              {}.tap do |hash|
         | 
| 121 | 
            -
                hash['Ruby coverage report']      = coverage if coverage
         | 
| 122 | 
            -
                hash['RSpec test report']         = rspec_files unless rspec_files.empty?
         | 
| 123 | 
            -
                hash['RuboCop inspection report'] = rubocop if rubocop
         | 
| 124 | 
            -
                hash['ESLint inspection report']  = eslint if eslint
         | 
| 125 | 
            -
                hash['Jest coverage report']      = jest if jest
         | 
| 126 | 
            -
                hash['Brakeman issues report']    = brakeman if brakeman
         | 
| 127 | 
            -
              end.each do |msg, links|
         | 
| 128 | 
            -
                links = [*links]
         | 
| 129 | 
            -
                if links.size == 1
         | 
| 130 | 
            -
                  message("[#{msg}](#{links[0]})")
         | 
| 131 | 
            -
                else
         | 
| 132 | 
            -
                  r         = /rspec-(.+)\.html$/
         | 
| 133 | 
            -
                  the_links = links.map { |l|
         | 
| 134 | 
            -
                    m = r.match(l)
         | 
| 135 | 
            -
                    if m
         | 
| 136 | 
            -
                      "[#{m[1]}](#{l})"
         | 
| 137 | 
            -
                    else
         | 
| 138 | 
            -
                      "[link](#{l})"
         | 
| 139 | 
            -
                    end
         | 
| 140 | 
            -
                  }.join(', ')
         | 
| 141 | 
            -
             | 
| 142 | 
            -
                  message("#{msg} - #{the_links}")
         | 
| 143 | 
            -
                end
         | 
| 144 | 
            -
              end
         | 
| 35 | 
            +
              should_have_migration_label = true if has_migrations || has_schema_changes
         | 
| 36 | 
            +
              toggle_label(github, 'run migration', should_have_migration_label)
         | 
| 145 37 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: netsoft-danger
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.7.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - urkle
         | 
| 8 | 
            -
            autorequire:
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2023-02-24 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: danger
         | 
| @@ -121,7 +121,7 @@ files: | |
| 121 121 | 
             
            homepage: https://github.com/NetsoftHoldings/danger
         | 
| 122 122 | 
             
            licenses: []
         | 
| 123 123 | 
             
            metadata: {}
         | 
| 124 | 
            -
            post_install_message:
         | 
| 124 | 
            +
            post_install_message: 
         | 
| 125 125 | 
             
            rdoc_options: []
         | 
| 126 126 | 
             
            require_paths:
         | 
| 127 127 | 
             
            - lib
         | 
| @@ -136,8 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 136 136 | 
             
                - !ruby/object:Gem::Version
         | 
| 137 137 | 
             
                  version: '0'
         | 
| 138 138 | 
             
            requirements: []
         | 
| 139 | 
            -
            rubygems_version: 3.0. | 
| 140 | 
            -
            signing_key:
         | 
| 139 | 
            +
            rubygems_version: 3.0.3
         | 
| 140 | 
            +
            signing_key: 
         | 
| 141 141 | 
             
            specification_version: 4
         | 
| 142 142 | 
             
            summary: Danger.systems conventions for Netsoft projects.
         | 
| 143 143 | 
             
            test_files: []
         |