danger-warnings_next_generation 0.0.2 → 0.1.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/README.md +23 -0
 - data/lib/warnings_next_generation/gem_version.rb +1 -1
 - data/lib/warnings_next_generation/plugin.rb +37 -3
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b52ea983c720acd63ecb4db0b2c3b2d401eaaf72402c4cb6382572bb36e5343c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8c7a354b7a3144c6120e160af5ba3fba1b56d3fcb71bc04e2fd0df03b9c5c273
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4d752d89c6d88b8d3b0005b799cb7d5d08cc3e3f108dd5a3825d8e489a526d1d2a92ee61bbdba8777217d6481ab3fecdffed8fda6d172f68ebc408007fcd85be
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6ac93eaa6e2dd50b1a31c311581eea2238e71657d5b54047af8e44a2cc4222d74fd881805bf9768487c545826dfe9b5947072c244f5c3c291731ab416dae44e2
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. 
     | 
|
| 
       4 
4 
     | 
    
         
             
            The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
         
     | 
| 
       5 
5 
     | 
    
         
             
            and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
            ## [0.1.0] - 2019-5-17
         
     | 
| 
      
 8 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 9 
     | 
    
         
            +
            - Add option to pass basic authentication
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### Changed
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Disable ssl verification
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       7 
14 
     | 
    
         
             
            ## [0.0.2] - 2019-5-17
         
     | 
| 
       8 
15 
     | 
    
         
             
            ### Fixed
         
     | 
| 
       9 
16 
     | 
    
         
             
            - Fixed OpenUri usage
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -163,3 +163,26 @@ warnings_next_generation.tools_report( 
     | 
|
| 
       163 
163 
     | 
    
         
             
            )
         
     | 
| 
       164 
164 
     | 
    
         
             
            </pre>
         
     | 
| 
       165 
165 
     | 
    
         
             
            </blockquote>   
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
            ## Authentication
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
            If you run a jenkins server with required authentication you can pass them to `danger-warnings_next_generation`.
         
     | 
| 
      
 170 
     | 
    
         
            +
            Create an API token with your CI user and do not pass normal password credentials.
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
            <blockquote>Run all with authentication
         
     | 
| 
      
 173 
     | 
    
         
            +
            <pre>
         
     | 
| 
      
 174 
     | 
    
         
            +
            warnings_next_generation.report(
         
     | 
| 
      
 175 
     | 
    
         
            +
                auth_user: "jenkins",
         
     | 
| 
      
 176 
     | 
    
         
            +
                auth_token: "MY_TOKEN"
         
     | 
| 
      
 177 
     | 
    
         
            +
            )
         
     | 
| 
      
 178 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 179 
     | 
    
         
            +
            </blockquote>   
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
            <blockquote>Run overview with authentication
         
     | 
| 
      
 182 
     | 
    
         
            +
            <pre>
         
     | 
| 
      
 183 
     | 
    
         
            +
            warnings_next_generation.overview_report(
         
     | 
| 
      
 184 
     | 
    
         
            +
                auth_user: "jenkins",
         
     | 
| 
      
 185 
     | 
    
         
            +
                auth_token: "MY_TOKEN"
         
     | 
| 
      
 186 
     | 
    
         
            +
            )
         
     | 
| 
      
 187 
     | 
    
         
            +
            </pre>
         
     | 
| 
      
 188 
     | 
    
         
            +
            </blockquote>   
         
     | 
| 
         @@ -37,6 +37,7 @@ module Danger 
     | 
|
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                def initialize(dangerfile)
         
     | 
| 
       39 
39 
     | 
    
         
             
                  @target_files = []
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @auth = nil
         
     | 
| 
       40 
41 
     | 
    
         
             
                  super(dangerfile)
         
     | 
| 
       41 
42 
     | 
    
         
             
                end
         
     | 
| 
       42 
43 
     | 
    
         | 
| 
         @@ -59,6 +60,7 @@ module Danger 
     | 
|
| 
       59 
60 
     | 
    
         
             
                  overview_table = WarningsNextGeneration::MarkdownTable.new
         
     | 
| 
       60 
61 
     | 
    
         
             
                  overview_table.overview_header(TABLE_HEADER_TOOL, EMOJI_BEETLE, EMOJI_X, EMOJI_CHECK_MARK)
         
     | 
| 
       61 
62 
     | 
    
         
             
                  options = args.first
         
     | 
| 
      
 63 
     | 
    
         
            +
                  check_auth(options)
         
     | 
| 
       62 
64 
     | 
    
         
             
                  tool_ids = include(options)
         
     | 
| 
       63 
65 
     | 
    
         
             
                  entry_count = 0
         
     | 
| 
       64 
66 
     | 
    
         | 
| 
         @@ -88,6 +90,7 @@ module Danger 
     | 
|
| 
       88 
90 
     | 
    
         
             
                # @return [void]
         
     | 
| 
       89 
91 
     | 
    
         
             
                def tools_report(*args)
         
     | 
| 
       90 
92 
     | 
    
         
             
                  options = args.first
         
     | 
| 
      
 93 
     | 
    
         
            +
                  check_auth(options)
         
     | 
| 
       91 
94 
     | 
    
         
             
                  tool_ids = include(options)
         
     | 
| 
       92 
95 
     | 
    
         | 
| 
       93 
96 
     | 
    
         
             
                  tools = tool_entries
         
     | 
| 
         @@ -125,6 +128,25 @@ module Danger 
     | 
|
| 
       125 
128 
     | 
    
         
             
                  base
         
     | 
| 
       126 
129 
     | 
    
         
             
                end
         
     | 
| 
       127 
130 
     | 
    
         | 
| 
      
 131 
     | 
    
         
            +
                def auth_user(options)
         
     | 
| 
      
 132 
     | 
    
         
            +
                  options && !options[:auth_user].nil? ? options[:auth_user] : nil
         
     | 
| 
      
 133 
     | 
    
         
            +
                end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                def auth_token(options)
         
     | 
| 
      
 136 
     | 
    
         
            +
                  options && !options[:auth_token].nil? ? options[:auth_token] : nil
         
     | 
| 
      
 137 
     | 
    
         
            +
                end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                def check_auth(options)
         
     | 
| 
      
 140 
     | 
    
         
            +
                  user = auth_user(options)
         
     | 
| 
      
 141 
     | 
    
         
            +
                  token = auth_token(options)
         
     | 
| 
      
 142 
     | 
    
         
            +
                  if user && token
         
     | 
| 
      
 143 
     | 
    
         
            +
                    @auth = {
         
     | 
| 
      
 144 
     | 
    
         
            +
                      user: user,
         
     | 
| 
      
 145 
     | 
    
         
            +
                      token: token,
         
     | 
| 
      
 146 
     | 
    
         
            +
                    }
         
     | 
| 
      
 147 
     | 
    
         
            +
                  end
         
     | 
| 
      
 148 
     | 
    
         
            +
                end
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
       128 
150 
     | 
    
         
             
                def check_baseline(options)
         
     | 
| 
       129 
151 
     | 
    
         
             
                  raise "Please set 'baseline' for correct inline comments." unless baseline(options)
         
     | 
| 
       130 
152 
     | 
    
         | 
| 
         @@ -197,17 +219,29 @@ module Danger 
     | 
|
| 
       197 
219 
     | 
    
         
             
                end
         
     | 
| 
       198 
220 
     | 
    
         | 
| 
       199 
221 
     | 
    
         
             
                def details_result(url)
         
     | 
| 
       200 
     | 
    
         
            -
                   
     | 
| 
      
 222 
     | 
    
         
            +
                  options = { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }
         
     | 
| 
      
 223 
     | 
    
         
            +
                  if @auth
         
     | 
| 
      
 224 
     | 
    
         
            +
                    options[:http_basic_authentication] = [@auth[:user], @auth[:token]]
         
     | 
| 
      
 225 
     | 
    
         
            +
                  end
         
     | 
| 
      
 226 
     | 
    
         
            +
                  content = OpenURI.open_uri("#{url}/all/api/json", options).read
         
     | 
| 
       201 
227 
     | 
    
         
             
                  JSON.parse(content)
         
     | 
| 
       202 
228 
     | 
    
         
             
                end
         
     | 
| 
       203 
229 
     | 
    
         | 
| 
       204 
230 
     | 
    
         
             
                def overview_result(url)
         
     | 
| 
       205 
     | 
    
         
            -
                   
     | 
| 
      
 231 
     | 
    
         
            +
                  options = { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }
         
     | 
| 
      
 232 
     | 
    
         
            +
                  if @auth
         
     | 
| 
      
 233 
     | 
    
         
            +
                    options[:http_basic_authentication] = [@auth[:user], @auth[:token]]
         
     | 
| 
      
 234 
     | 
    
         
            +
                  end
         
     | 
| 
      
 235 
     | 
    
         
            +
                  content = OpenURI.open_uri("#{url}/api/json", options).read
         
     | 
| 
       206 
236 
     | 
    
         
             
                  JSON.parse(content)
         
     | 
| 
       207 
237 
     | 
    
         
             
                end
         
     | 
| 
       208 
238 
     | 
    
         | 
| 
       209 
239 
     | 
    
         
             
                def aggregation_result
         
     | 
| 
       210 
     | 
    
         
            -
                   
     | 
| 
      
 240 
     | 
    
         
            +
                  options = { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }
         
     | 
| 
      
 241 
     | 
    
         
            +
                  if @auth
         
     | 
| 
      
 242 
     | 
    
         
            +
                    options[:http_basic_authentication] = [@auth[:user], @auth[:token]]
         
     | 
| 
      
 243 
     | 
    
         
            +
                  end
         
     | 
| 
      
 244 
     | 
    
         
            +
                  content = OpenURI.open_uri("#{ENV['BUILD_URL']}/warnings-ng/api/json", options).read
         
     | 
| 
       211 
245 
     | 
    
         
             
                  JSON.parse(content)
         
     | 
| 
       212 
246 
     | 
    
         
             
                end
         
     | 
| 
       213 
247 
     | 
    
         
             
              end
         
     |