danger-todoist 0.3.0 → 1.0.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 +4 -0
 - data/README.md +3 -6
 - data/lib/todoist/gem_version.rb +1 -1
 - data/lib/todoist/plugin.rb +10 -4
 - data/spec/spec_helper.rb +12 -0
 - data/spec/todoist_spec.rb +16 -16
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: cd9c28016359b27e3cc65bfee31b76086743db32
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6f24675207d0aef9ce0ef092fca5b8431d91327c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d67dc9615ec24a7e81100f9855194a0d07c97ff6fbae3cf9f4a4582486a310c7e86ece35d497a31f9dbe9d0d445bfe3c77c79b3c6ff880a6defeeda2f8a4e697
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 82c158c181261b48cdefa2d5918aa999be4514ec4ca5f3edadfc0c0014b773855818b66e0187e3dc3764defa80e0140565e90c9800fc3ab05ac0b6022d81175d
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,21 +2,18 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            # danger-todoist
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
            danger-todoist is a [https://danger.systems](danger) plugin to automatically notify you of
         
     | 
| 
      
 6 
     | 
    
         
            +
            todos left in the code of a pull/merge request.
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            ## Installation
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
            Add `gem 'danger-todoist'` to your `Gemfile` and start using todoist in your `Dangerfile`.
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
12 
     | 
    
         
             
            ## Usage
         
     | 
| 
       12 
13 
     | 
    
         | 
| 
       13 
14 
     | 
    
         
             
                Methods and attributes from this plugin are available in
         
     | 
| 
       14 
15 
     | 
    
         
             
                your `Dangerfile` under the `todoist` namespace.
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
            ### todoist
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            This is a danger plugin to detect any TODO/FIXME entries left in the code.
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
17 
     | 
    
         
             
            <blockquote>Ensure, by warning, there are no TODOS left in the modified code
         
     | 
| 
       21 
18 
     | 
    
         
             
              <pre>
         
     | 
| 
       22 
19 
     | 
    
         
             
            todoist.warn_for_todos</pre>
         
     | 
    
        data/lib/todoist/gem_version.rb
    CHANGED
    
    
    
        data/lib/todoist/plugin.rb
    CHANGED
    
    | 
         @@ -67,10 +67,9 @@ module Danger 
     | 
|
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
                  markdown("#### Todos left in files")
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
                  @todos 
     | 
| 
       71 
     | 
    
         
            -
                     
     | 
| 
       72 
     | 
    
         
            -
                     
     | 
| 
       73 
     | 
    
         
            -
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
                  @todos
         
     | 
| 
      
 71 
     | 
    
         
            +
                    .group_by(&:file)
         
     | 
| 
      
 72 
     | 
    
         
            +
                    .each { |file, todos| print_todos_per_file(file, todos) }
         
     | 
| 
       74 
73 
     | 
    
         
             
                end
         
     | 
| 
       75 
74 
     | 
    
         | 
| 
       76 
75 
     | 
    
         
             
                #
         
     | 
| 
         @@ -85,6 +84,13 @@ module Danger 
     | 
|
| 
       85 
84 
     | 
    
         | 
| 
       86 
85 
     | 
    
         
             
                private
         
     | 
| 
       87 
86 
     | 
    
         | 
| 
      
 87 
     | 
    
         
            +
                def print_todos_per_file(file, todos)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  markdown("- #{file}")
         
     | 
| 
      
 89 
     | 
    
         
            +
                  todos
         
     | 
| 
      
 90 
     | 
    
         
            +
                    .select(&:text)
         
     | 
| 
      
 91 
     | 
    
         
            +
                    .each { |todo| markdown("  - #{todo.text}") }
         
     | 
| 
      
 92 
     | 
    
         
            +
                end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
       88 
94 
     | 
    
         
             
                def call_method_for_todos(method)
         
     | 
| 
       89 
95 
     | 
    
         
             
                  find_todos if @todos.nil?
         
     | 
| 
       90 
96 
     | 
    
         
             
                  public_send(method, message, sticky: false) unless @todos.empty?
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -57,3 +57,15 @@ def testing_dangerfile 
     | 
|
| 
       57 
57 
     | 
    
         
             
              env = Danger::EnvironmentManager.new(testing_env)
         
     | 
| 
       58 
58 
     | 
    
         
             
              Danger::Dangerfile.new(env, testing_ui)
         
     | 
| 
       59 
59 
     | 
    
         
             
            end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            def failures
         
     | 
| 
      
 62 
     | 
    
         
            +
              @dangerfile.status_report[:errors]
         
     | 
| 
      
 63 
     | 
    
         
            +
            end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            def warnings
         
     | 
| 
      
 66 
     | 
    
         
            +
              @dangerfile.status_report[:warnings]
         
     | 
| 
      
 67 
     | 
    
         
            +
            end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            def markdowns
         
     | 
| 
      
 70 
     | 
    
         
            +
              @dangerfile.status_report[:markdowns].map(&:message)
         
     | 
| 
      
 71 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/todoist_spec.rb
    CHANGED
    
    | 
         @@ -14,10 +14,17 @@ module Danger 
     | 
|
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                  context "changed files containing newly introduced todos" do
         
     | 
| 
       16 
16 
     | 
    
         
             
                    before do
         
     | 
| 
      
 17 
     | 
    
         
            +
                      patch = <<PATCH
         
     | 
| 
      
 18 
     | 
    
         
            +
            + # TODO: some todo
         
     | 
| 
      
 19 
     | 
    
         
            +
            + def foo
         
     | 
| 
      
 20 
     | 
    
         
            +
            + end
         
     | 
| 
      
 21 
     | 
    
         
            +
            + # TODO: more todo in same file
         
     | 
| 
      
 22 
     | 
    
         
            +
            PATCH
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       17 
24 
     | 
    
         
             
                      modified = Git::Diff::DiffFile.new(
         
     | 
| 
       18 
25 
     | 
    
         
             
                        "base",
         
     | 
| 
       19 
26 
     | 
    
         
             
                        path:  "some/file.rb",
         
     | 
| 
       20 
     | 
    
         
            -
                        patch:  
     | 
| 
      
 27 
     | 
    
         
            +
                        patch: patch
         
     | 
| 
       21 
28 
     | 
    
         
             
                      )
         
     | 
| 
       22 
29 
     | 
    
         
             
                      added = Git::Diff::DiffFile.new(
         
     | 
| 
       23 
30 
     | 
    
         
             
                        "base",
         
     | 
| 
         @@ -62,14 +69,17 @@ module Danger 
     | 
|
| 
       62 
69 
     | 
    
         
             
                      expect(markdowns).to eq(
         
     | 
| 
       63 
70 
     | 
    
         
             
                        [
         
     | 
| 
       64 
71 
     | 
    
         
             
                          "#### Todos left in files",
         
     | 
| 
       65 
     | 
    
         
            -
                          "- some/file.rb 
     | 
| 
       66 
     | 
    
         
            -
                          "-  
     | 
| 
      
 72 
     | 
    
         
            +
                          "- some/file.rb",
         
     | 
| 
      
 73 
     | 
    
         
            +
                          "  - some todo",
         
     | 
| 
      
 74 
     | 
    
         
            +
                          "  - more todo in same file",
         
     | 
| 
      
 75 
     | 
    
         
            +
                          "- another/stuff.rb",
         
     | 
| 
      
 76 
     | 
    
         
            +
                          "  - another todo"
         
     | 
| 
       67 
77 
     | 
    
         
             
                        ]
         
     | 
| 
       68 
78 
     | 
    
         
             
                      )
         
     | 
| 
       69 
79 
     | 
    
         
             
                    end
         
     | 
| 
       70 
80 
     | 
    
         | 
| 
       71 
81 
     | 
    
         
             
                    it "exposes todos to the dangerfile" do
         
     | 
| 
       72 
     | 
    
         
            -
                      expect(@todoist.todos.length).to eq( 
     | 
| 
      
 82 
     | 
    
         
            +
                      expect(@todoist.todos.length).to eq(3)
         
     | 
| 
       73 
83 
     | 
    
         
             
                      expect(@todoist.todos.first.text).to eq("some todo")
         
     | 
| 
       74 
84 
     | 
    
         
             
                      expect(@todoist.todos.last.file).to eq("another/stuff.rb")
         
     | 
| 
       75 
85 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -104,23 +114,13 @@ module Danger 
     | 
|
| 
       104 
114 
     | 
    
         
             
                    allow(@dangerfile.git).to receive(:added_files).and_return([])
         
     | 
| 
       105 
115 
     | 
    
         | 
| 
       106 
116 
     | 
    
         
             
                    @todoist.warn_for_todos
         
     | 
| 
      
 117 
     | 
    
         
            +
                    @todoist.fail_for_todos
         
     | 
| 
       107 
118 
     | 
    
         
             
                    @todoist.print_todos_table
         
     | 
| 
       108 
119 
     | 
    
         | 
| 
       109 
120 
     | 
    
         
             
                    expect(warnings).to be_empty
         
     | 
| 
      
 121 
     | 
    
         
            +
                    expect(failures).to be_empty
         
     | 
| 
       110 
122 
     | 
    
         
             
                    expect(markdowns).to be_empty
         
     | 
| 
       111 
123 
     | 
    
         
             
                  end
         
     | 
| 
       112 
124 
     | 
    
         
             
                end
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
                def failures
         
     | 
| 
       115 
     | 
    
         
            -
                  @dangerfile.status_report[:errors]
         
     | 
| 
       116 
     | 
    
         
            -
                end
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                def warnings
         
     | 
| 
       119 
     | 
    
         
            -
                  @dangerfile.status_report[:warnings]
         
     | 
| 
       120 
     | 
    
         
            -
                end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                def markdowns
         
     | 
| 
       123 
     | 
    
         
            -
                  @dangerfile.status_report[:markdowns].map(&:message)
         
     | 
| 
       124 
     | 
    
         
            -
                end
         
     | 
| 
       125 
125 
     | 
    
         
             
              end
         
     | 
| 
       126 
126 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: danger-todoist
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Hannes Käufler
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-09-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: danger-plugin-api
         
     |