Answers: <p>At the moment it looks like it is not possible to define a minimum code coverage as the ticket that was created is still open <a href="https://github.com/linkedin/pygradle/issues/184" rel="nofollow noreferrer">https://github.com/linkedin/pygradle/issues/184</a></p>
  
Answers: CC BY-SA 3.0
Answers: 2018-04-27T16:38:27.697Z
Answers: 2018-04-27T16:38:27.697Z
Answers: 030
Body: <p><a href="https://github.com/linkedin/pygradle" rel="nofollow noreferrer">Pygradle</a> is used to build and test a Python project. In gradle it is possible to define a minimum code <a href="https://docs.gradle.org/current/userguide/jacoco_plugin.html" rel="nofollow noreferrer">coverage percentage</a>:</p>
  
  <blockquote>
  <pre><code>jacocoTestCoverageVerification {
      violationRules {
          rule {
              limit {
                  minimum = 0.5
              }
          }
  
          rule {
              enabled = false
              element = 'CLASS'
              includes = ['org.gradle.*']
  
              limit {
                  counter = 'LINE'
                  value = 'TOTALCOUNT'
                  maximum = 0.3
              }
          }
      }
  }
  </code></pre>
  </blockquote>
  
  <p>If this limit is not reached, build will fail. Is it possible to define a minimum code coverage using Pygradle?</p>
  
  <p>When the above snippet is run, the build fails and the following is returned:</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * Where:
  Build file '/home/user/SomeProject/build.gradle' line: 14
  
  * What went wrong:
  A problem occurred evaluating root project 'SomeProject'.
  &gt; Could not find method jacocoTestCoverageVerification() for arguments [build_fsdafasdfsa] on root project 'SomeProject' of type org.gradle.api.Project.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 2s
  </code></pre>
  
Comments: CC BY-SA 3.0
Comments: 2018-01-23T14:36:53.863Z
Comments: Possible duplicate of [Is it possible to set a minimum Python version in Pygradle?](https://devops.stackexchange.com/questions/3150/is-it-possible-to-set-a-minimum-python-version-in-pygradle)
Comments: Patrick Mevzek
Comments: CC BY-SA 3.0
Comments: 2018-04-27T16:14:17.487Z
Comments: @PatrickMevzek This is not a duplicate of that Q&A as that one is about a minimum version.
Comments: 030
Tags: <pygradle>
Title: Is it possible to define a minimum code coverage using Pygradle?
UserDisplayName: 030
ThreadText: # Is it possible to define a minimum code coverage using Pygradle?
  
  (Asked by: username_0 on 2018-01-22)
  
  [Pygradle](https://github.com/linkedin/pygradle) is used to build and test a Python project. In gradle it is possible to define a minimum code [coverage percentage](https://docs.gradle.org/current/userguide/jacoco_plugin.html):
  
  > ```
  > jacocoTestCoverageVerification {
  >     violationRules {
  >         rule {
  >             limit {
  >                 minimum = 0.5
  >             }
  >         }
  >
  >         rule {
  >             enabled = false
  >             element = 'CLASS'
  >             includes = ['org.gradle.*']
  >
  >             limit {
  >                 counter = 'LINE'
  >                 value = 'TOTALCOUNT'
  >                 maximum = 0.3
  >             }
  >         }
  >     }
  > }
  >
  > ```
  
  If this limit is not reached, build will fail. Is it possible to define a minimum code coverage using Pygradle?
  
  When the above snippet is run, the build fails and the following is returned:
  
  ```
  FAILURE: Build failed with an exception.
  
  * Where:
  Build file '/home/user/SomeProject/build.gradle' line: 14
  
  * What went wrong:
  A problem occurred evaluating root project 'SomeProject'.
  > Could not find method jacocoTestCoverageVerification() for arguments [build_fsdafasdfsa] on root project 'SomeProject' of type org.gradle.api.Project.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 2s
  
  ```
  
  **Tags:** pygradle
  
  > **Comments:**
  > **username_1**: Possible duplicate of [Is it possible to set a minimum Python version in Pygradle?](https://devops.stackexchange.com/questions/3150/is-it-possible-to-set-a-minimum-python-version-in-pygradle)  
  > **username_0**: @username_1 This is not a duplicate of that Q&A as that one is about a minimum version.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-04-27. Score: 0 | Accepted answer
  
  At the moment it looks like it is not possible to define a minimum code coverage as the ticket that was created is still open <https://github.com/linkedin/pygradle/issues/184>
  
  
  ---
  
  