codacy-coverage 0.0.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed371108f2d9c6b2f61a19b7ea7aba4e9557e194
4
- data.tar.gz: 0727932b29163f3e42e9754cfbc56d21beb74bdf
3
+ metadata.gz: 8df817bbfce9af912bf497538caee4b17d9ddc48
4
+ data.tar.gz: 36c282bdc01b51a807d3e692b8ba8ad38c7e2ba7
5
5
  SHA512:
6
- metadata.gz: a6adaf3d319cc860ac86d290900db388031ddf20f7fbb1b0b1925aa2d34493ac272661d274e9e75c7ba87f1d20de6b4db6892d8d5c3f4a6eddcea0f0ecbc1716
7
- data.tar.gz: e562e27817edb1926519cc1c51ed38411be78a640c5b80338a6af2a189d6f9fba17da643c27985dfc36e3f44206c4a2f7ccbd7cc8c93601e231dbc6fdbe1c956
6
+ metadata.gz: a266657f6cfd7a0284c20fc1058ed951e6b21d9d3f624ecea51b065f7e4a0c0db35d8f4d6c25403c8bbceecb4d1bb339ee6dea3c62ac5f529bbdbc106387d2bc
7
+ data.tar.gz: 53788e77ea9a71963f8a3c87986bc0e516a3ce5c256aa76f309714bba75d172f8817fae868f41bc61b70d7453389e780fdcd22459d37cfa6bd249616eae983e8
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
15
  gem.name = "codacy-coverage"
16
16
  gem.require_paths = ["lib"]
17
- gem.version = '0.0.1'
17
+ gem.version = '0.1.0'
18
18
 
19
19
  gem.required_ruby_version = '>= 1.8.7'
20
20
 
@@ -2,8 +2,12 @@ module Codacy
2
2
  class Formatter
3
3
 
4
4
  def format(result)
5
- parse_result = Codacy::Parser.parse_file(result)
6
- Codacy::ClientAPI.post_results(parse_result)
5
+ if should_run?
6
+ parse_result = Codacy::Parser.parse_file(result)
7
+ Codacy::ClientAPI.post_results(parse_result)
8
+ else
9
+ logger.info("Running locally, skipping Codacy coverage")
10
+ end
7
11
  rescue => ex
8
12
  logger.fatal(ex)
9
13
  false
@@ -11,6 +15,10 @@ module Codacy
11
15
 
12
16
  private
13
17
 
18
+ def should_run?
19
+ ENV["CI"] || ENV["JENKINS_URL"] || ENV['TDDIUM'] || ENV["CODACY_RUN_LOCAL"]
20
+ end
21
+
14
22
  def logger
15
23
  Codacy::Configuration.logger
16
24
  end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'simplecov'
2
2
 
3
3
  class InceptionFormatter
4
4
  def format(result)
5
+ ENV["CODACY_RUN_LOCAL"] = 'true'
5
6
  Codacy::Formatter.new.format(result)
6
7
  end
7
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codacy-coverage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nuno Teixeira