finviz 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 835b79336936f1465a97e86c3a82ea4f8d4011b0c0dc4fed645a5d7abef53556
4
- data.tar.gz: 56f0e86206d7d7706adb321e4522adb08cd19d13435a5a2fc3acdf296c7481cc
3
+ metadata.gz: d03d07f3594c1cd9b86ede6baf392a71811b4f9f0d8118c05635fa7a623cd716
4
+ data.tar.gz: 01dd8328cf26a2b3a1d5e8d0eb16555193ad4f13eb08e38140df660b65e74e19
5
5
  SHA512:
6
- metadata.gz: d3cd8314b97d13589148ffd829c532debc4ec48d43c61a9d8f48d090bca2c09fc13206d5f372b7ed46f225148880980a90b795e9b9410647d234ec36c10cfc3e
7
- data.tar.gz: adc4acfc82ac05864a10c6f06d5825cadeec2b271f8be7b4ecee295eea60d2322df43805c8644ec6cacfe7b5deb311e3b1149ec4fd3b9d026cccb87761174791
6
+ metadata.gz: a963fd3f21721f2250fe538ddad20b664c21f834cf1b40e3715d48681b647a2fd30e14804311383f174c29e1476f61a04669b1de6352f1123dbda400932d6448
7
+ data.tar.gz: 3c8c1bff1f2bb1f430768db323f77b7e030140af4bad6add97fc90d129793ca75597cca4fa70416bb881c2d48ad066eba0f0f89dd0675a67762db457b28808f4
data/.circleci/config.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  version: 2.1
2
2
  defaults: &defaults
3
+ working_directory: ~/repo
3
4
  docker:
4
5
  - image: circleci/ruby:2.6.3-stretch-node
5
6
  environment:
@@ -31,29 +32,38 @@ commands:
31
32
  key: v1-dependencies-{{ checksum "Gemfile.lock" }}
32
33
 
33
34
  jobs:
35
+ download_test_reporter:
36
+ <<: *defaults
37
+ steps:
38
+ - run:
39
+ name: Download cc-test-reporter
40
+ command: |
41
+ mkdir -p tmp/
42
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
43
+ chmod +x ./tmp/cc-test-reporter
44
+ - persist_to_workspace:
45
+ root: tmp
46
+ paths:
47
+ - cc-test-reporter
34
48
  rspec:
35
49
  <<: *defaults
50
+ environment:
51
+ COVERAGE: "1"
52
+ CI: "1"
36
53
  steps:
37
54
  - prepare
55
+ - attach_workspace:
56
+ at: ~/repo/tmp
38
57
  - run:
39
58
  name: Rspec
40
59
  command: |
41
- mkdir /tmp/test-results
42
-
43
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
44
-
45
- bundle exec rspec --format progress \
46
- --format RspecJunitFormatter \
47
- --out /tmp/test-results/rspec.xml \
48
- --tag ~type:performance \
49
- $TEST_FILES
50
- # collect reports
51
- - store_test_results:
52
- path: /tmp/test-results
53
- - store_artifacts:
54
- path: /tmp/test-results
55
- destination: test-results
60
+ bundle exec rspec
56
61
 
62
+ ./tmp/cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.json coverage/coverage.json
63
+ - persist_to_workspace:
64
+ root: tmp
65
+ paths:
66
+ - codeclimate.json
57
67
  rubocop:
58
68
  <<: *defaults
59
69
  steps:
@@ -61,10 +71,27 @@ jobs:
61
71
  - run:
62
72
  name: Rubocop
63
73
  command: bundle exec rubocop
74
+ upload-coverage:
75
+ <<: *defaults
76
+ environment:
77
+ CC_TEST_REPORTER_ID: 83001b65b7434ac2263f7534d4f1fc3376ce8f73662082682947b2875d314981
78
+ steps:
79
+ - attach_workspace:
80
+ at: ~/repo/tmp
81
+ - run:
82
+ name: Upload coverage results to Code Climate
83
+ command: |
84
+ ./tmp/cc-test-reporter upload-coverage -i tmp/codeclimate.json
64
85
 
65
86
  workflows:
66
87
  version: 2
67
88
  pipeline:
68
89
  jobs:
69
- - rspec
90
+ - download_test_reporter
91
+ - rspec:
92
+ requires:
93
+ - download_test_reporter
70
94
  - rubocop
95
+ - upload-coverage:
96
+ requires:
97
+ - rspec
data/.hound.yml ADDED
@@ -0,0 +1,5 @@
1
+ # http://help.houndci.com/en/articles/2461415-supported-linters
2
+ # have to use older version just because it is the latest one supported by hound
3
+ rubocop:
4
+ version: 1.5.2
5
+ config_file: .rubocop.yml
data/Gemfile CHANGED
@@ -8,13 +8,14 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
 
10
10
  gem "pry", "~> 0.14.0"
11
- gem "rubocop", "~> 1.14.0", require: false
11
+ gem "rubocop", "~> 1.15.0", require: false
12
12
  gem "rubocop-rake", "~> 0.5.0", require: false
13
13
  gem "rubocop-rspec", "~> 2.3.0", require: false
14
14
 
15
15
  group :test do
16
16
  gem "rspec", ">= 3.10.0", "< 4.0"
17
17
  gem "rspec_junit_formatter"
18
+ gem "simplecov", "~> 0.21.0", require: false
18
19
  gem "vcr", "~> 6.0.0"
19
20
  gem "webmock", "~> 3.13.0"
20
21
  end
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  [![CircleCI](https://circleci.com/gh/kvokka/finviz.svg?style=svg&circle-token=804e72e82fd4ccedc8f06cb332cc53d21e83535c)](https://circleci.com/gh/kvokka/finviz)
2
2
  [![Gem Version](https://img.shields.io/gem/v/finviz.svg)](https://rubygems.org/gems/finviz)
3
3
  [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/3e73fca4653a06e1a607/maintainability)](https://codeclimate.com/github/kvokka/finviz/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/3e73fca4653a06e1a607/test_coverage)](https://codeclimate.com/github/kvokka/finviz/test_coverage)
4
6
 
5
7
  # Finviz
6
8
 
@@ -3,6 +3,14 @@
3
3
  module Finviz
4
4
  # Fetch the details of the security
5
5
  class QuotesFetcher
6
+
7
+ def self.dangerous_methods
8
+ @dangerous_methods ||= OpenStruct.instance_methods
9
+ .map(&:to_s)
10
+ .select {|m| m.length <=5 }
11
+ .reject {|m| m =~ /!|\?|\>|\<|\=|_|\[|\]/ }
12
+ end
13
+
6
14
  def initialize(tickers: [])
7
15
  @tickers = Array(tickers)
8
16
  end
@@ -16,6 +24,8 @@ module Finviz
16
24
  result.add_quote_from_xpath(ticker_xpath, table_xpath)
17
25
  end
18
26
  end
27
+
28
+ self.class.dangerous_methods.each { |m| result.instance_eval("undef :#{m}") }
19
29
  end
20
30
  end
21
31
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Finviz
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finviz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kvokka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-18 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -89,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".circleci/config.yml"
91
91
  - ".gitignore"
92
+ - ".hound.yml"
92
93
  - ".rspec"
93
94
  - ".rubocop.yml"
94
95
  - CHANGELOG.md