inq 26.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.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.cirrus.yml +84 -0
  3. data/.codeclimate.yml +23 -0
  4. data/.github_changelog_generator +2 -0
  5. data/.gitignore +15 -0
  6. data/.rspec +2 -0
  7. data/.rubocop.yml +260 -0
  8. data/.travis.yml +24 -0
  9. data/CHANGELOG.md +499 -0
  10. data/CODE_OF_CONDUCT.md +49 -0
  11. data/CONTRIBUTING.md +34 -0
  12. data/Gemfile +15 -0
  13. data/ISSUES.md +62 -0
  14. data/LICENSE.txt +21 -0
  15. data/README.md +91 -0
  16. data/Rakefile +76 -0
  17. data/bin/console +14 -0
  18. data/bin/prerelease-generate-changelog +28 -0
  19. data/bin/setup +8 -0
  20. data/bors.toml +17 -0
  21. data/build-debug.rb +20 -0
  22. data/exe/inq +7 -0
  23. data/fixtures/vcr_cassettes/how-is-example-empty-repository.yml +597 -0
  24. data/fixtures/vcr_cassettes/how-is-example-repository.yml +768 -0
  25. data/fixtures/vcr_cassettes/how-is-from-config-frontmatter.yml +23940 -0
  26. data/fixtures/vcr_cassettes/how-is-how-is-travis-api-repos-builds.yml +66 -0
  27. data/fixtures/vcr_cassettes/how-is-with-config-file.yml +23940 -0
  28. data/fixtures/vcr_cassettes/how_is_contributions_additions_count.yml +247 -0
  29. data/fixtures/vcr_cassettes/how_is_contributions_all_contributors.yml +247 -0
  30. data/fixtures/vcr_cassettes/how_is_contributions_changed_files.yml +247 -0
  31. data/fixtures/vcr_cassettes/how_is_contributions_changes.yml +247 -0
  32. data/fixtures/vcr_cassettes/how_is_contributions_commits.yml +247 -0
  33. data/fixtures/vcr_cassettes/how_is_contributions_compare_url.yml +81 -0
  34. data/fixtures/vcr_cassettes/how_is_contributions_default_branch.yml +81 -0
  35. data/fixtures/vcr_cassettes/how_is_contributions_deletions_count.yml +247 -0
  36. data/fixtures/vcr_cassettes/how_is_contributions_new_contributors.yml +402 -0
  37. data/fixtures/vcr_cassettes/how_is_contributions_summary.yml +325 -0
  38. data/fixtures/vcr_cassettes/how_is_contributions_summary_2.yml +325 -0
  39. data/inq.gemspec +45 -0
  40. data/lib/inq.rb +63 -0
  41. data/lib/inq/cacheable.rb +71 -0
  42. data/lib/inq/cli.rb +135 -0
  43. data/lib/inq/config.rb +123 -0
  44. data/lib/inq/constants.rb +9 -0
  45. data/lib/inq/date_time_helpers.rb +48 -0
  46. data/lib/inq/exe.rb +66 -0
  47. data/lib/inq/frontmatter.rb +51 -0
  48. data/lib/inq/report.rb +140 -0
  49. data/lib/inq/report_collection.rb +113 -0
  50. data/lib/inq/sources.rb +11 -0
  51. data/lib/inq/sources/ci/appveyor.rb +87 -0
  52. data/lib/inq/sources/ci/travis.rb +159 -0
  53. data/lib/inq/sources/github.rb +57 -0
  54. data/lib/inq/sources/github/contributions.rb +204 -0
  55. data/lib/inq/sources/github/issue_fetcher.rb +148 -0
  56. data/lib/inq/sources/github/issues.rb +126 -0
  57. data/lib/inq/sources/github/pulls.rb +29 -0
  58. data/lib/inq/sources/github_helpers.rb +106 -0
  59. data/lib/inq/template.rb +9 -0
  60. data/lib/inq/templates/contributions_partial.html +1 -0
  61. data/lib/inq/templates/issues_or_pulls_partial.html +7 -0
  62. data/lib/inq/templates/new_contributors_partial.html +5 -0
  63. data/lib/inq/templates/report.html +19 -0
  64. data/lib/inq/templates/report_partial.html +12 -0
  65. data/lib/inq/text.rb +26 -0
  66. data/lib/inq/version.rb +6 -0
  67. metadata +263 -0
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at me@duckie.co. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
@@ -0,0 +1,34 @@
1
+ # How to contribute
2
+
3
+ Want to contribute to Inq? This document has the information you need
4
+ to make sure the process goes smoothly.
5
+
6
+ By contributing to this project, you agree to follow our
7
+ [Code of Conduct](https://github.com/duckinator/inq/blob/master/CODE_OF_CONDUCT.md).
8
+
9
+ ## Guidelines
10
+
11
+ 2. New features should be paired with tests.
12
+ 3. Ensure your code follows our general code style.
13
+ * Run `bundle exec rubocop` to check for any violations.
14
+ 4. Don't modify the CHANGELOG or version number.
15
+ 5. If you need feedback or assistance, feel free to join us on Slack
16
+ (http://slack.bundler.io/) or open an issue on GitHub
17
+ (https://github.com/duckinator/inq).
18
+
19
+ ## Getting started
20
+
21
+ ```
22
+ $ bundle install
23
+ $ bundle exec rake test
24
+ ```
25
+
26
+ Then, to run inq commands, simply run `bundle exec inq <args>`.
27
+
28
+ ## Issues
29
+
30
+ Inq uses the GitHub issue tracker for tracking bugs and feature
31
+ requests.
32
+
33
+ For more details, including information on the various labels we use, see
34
+ [ISSUES.md](https://github.com/duckinator/inq/blob/master/ISSUES.md).
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Inq only supports Ruby versions under "normal maintenance".
6
+ # This number should be updated when a Ruby version goes into security
7
+ # maintenance.
8
+ #
9
+ # Ruby maintenance info: https://www.ruby-lang.org/en/downloads/branches/
10
+ #
11
+ # NOTE: Update inq.gemspec when this is updated!
12
+ ruby "~> 2.4"
13
+
14
+ # Specify your gem's dependencies in inq.gemspec
15
+ gemspec
@@ -0,0 +1,62 @@
1
+ # Issue Management
2
+
3
+ This document explains what labels on a given issue mean, or to help you
4
+ choose labels for new/updated issues.
5
+
6
+ We use an issue tracker to organize and prioritize work by allowing users
7
+ to report bugs, request features or documentation, and start discussions.
8
+
9
+ ---
10
+
11
+ ## high priority
12
+
13
+ An issue that should be resolved as soon as possible.
14
+
15
+ ## in progress
16
+
17
+ An issue which is currently being worked on. This should be added when
18
+ someone begins work on an issue.
19
+
20
+ ## ready
21
+
22
+ An issue which is ready to be worked on. This should be removed when
23
+ someone begins work on an issue.
24
+
25
+ ## size: large
26
+
27
+ An issue which is expected to take a large amount of effort to resolve.
28
+
29
+ ## size: small
30
+
31
+ An issue which is expected to be relatively simple to resolve.
32
+
33
+ ## type: bug report
34
+
35
+ A bug report.
36
+
37
+ ## type: documentation
38
+
39
+ A request for additional or updated documentation.
40
+
41
+ ## type: feature request
42
+
43
+ A request for a new feature to be added.
44
+
45
+ ## type: question/discussion
46
+
47
+ A question or discussion. Issues with this label are likely to not have
48
+ any immediately-actionable tasks.
49
+
50
+ When any tasks do arise from an issue with this label, more specific
51
+ issues will likely be opened to replace it.
52
+
53
+ ## type: refactoring
54
+
55
+ A request for a particular section of code to be refactored.
56
+
57
+ Including concrete suggestions for smaller areas will likely get these
58
+ issues resolved more quickly.
59
+
60
+ ## type: tests
61
+
62
+ A request for new or improved tests addressing specific situations.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016-2019 Ellen Marie Dash and Inq contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,91 @@
1
+ [![Travis](https://img.shields.io/travis/duckinator/inq.svg)](https://travis-ci.org/duckinator/inq)
2
+ [![Code Climate](https://img.shields.io/codeclimate/github/duckinator/inq.svg)](https://codeclimate.com/github/duckinator/inq)
3
+ [![Gem](https://img.shields.io/gem/v/inq.svg)](https://rubygems.org/gems/inq)
4
+ [Documentation](https://how-is.github.io)
5
+
6
+ # Inq
7
+
8
+ Inq is tool for generating summaries of the health of a codebase hosted on GitHub. It uses information available from issues and pull requests to provide an overview of a repository and highlight problem areas of the codebase.
9
+
10
+ Reports can be generated retroactively.
11
+
12
+ If you want to contribute or discuss inq, you can [join Bundler's slack](http://slack.bundler.io/) and join the #how_is channel.
13
+
14
+ ## Installation
15
+
16
+ $ gem install inq
17
+
18
+ ## Configuration
19
+
20
+ To avoid errors due to hitting rate limits, Inq requires a Personal
21
+ Access Token for GitHub.
22
+
23
+ ### Acquiring A Personal Access Token
24
+
25
+ To acquire a personal access token:
26
+
27
+ 1. Go to: https://github.com/settings/tokens/new
28
+ 2. For `Token description`, enter `inq CLI client`.
29
+ 3. Scroll to the bottom of the page.
30
+ 4. Click `Generate token`. This will take you to a new page.
31
+ 5. Save the token somewhere. **You can't access it again.**
32
+
33
+ **NOTE:** Inq _only_ needs read access.
34
+
35
+ #### Using The Token
36
+
37
+ Create a file in `~/.config/inq/config.yml`:
38
+
39
+ ```
40
+ sources/github:
41
+ username: <USERNAME>
42
+ token: <TOKEN>
43
+ ```
44
+
45
+ Make sure to replace `<TOKEN>` with the actual token, and `<USERNAME>`
46
+ with your GitHub username.
47
+
48
+ ## Usage
49
+
50
+ ### Command Line
51
+
52
+ $ inq --repository REPOSITORY --date DATE [--output OUTPUT_FILENAME]
53
+ # OUTPUT_FILENAME defaults to ./report.html.
54
+
55
+ or
56
+
57
+ $ inq --date DATE --config CONFIG_FILENAME
58
+
59
+ #### Example \#1
60
+
61
+ $ inq rubygems/rubygems 2016-12-01 --output report-2016-12-01.html
62
+
63
+ The above command creates a HTML file containing the report for the state of
64
+ the rubygems/rubygems repository, for November 01 2016 to
65
+ December 01 2016, and saves it as `./report-2016-12-01.html`.
66
+
67
+ #### Example \#2
68
+
69
+ $ inq --date 2016-12-01 --config some-config.yml
70
+
71
+ This generates the report(s) specified in the config file, for the period
72
+ from November 01 2016 to December 01 2016, and saves them in the
73
+ locations specified in the config file.
74
+
75
+ #### Screenshot
76
+
77
+ ![image](https://user-images.githubusercontent.com/211/55504154-89284180-5650-11e9-9a13-e03e9b83c749.png)
78
+
79
+ ## Development
80
+
81
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec inq` to use the gem in this directory, ignoring other installed copies of this gem.
82
+
83
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
84
+
85
+ ## Contributing
86
+
87
+ Bug reports and pull requests are welcome on GitHub at https://github.com/duckinator/inq. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
88
+
89
+ ## License
90
+
91
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "timecop"
6
+ require "inq"
7
+
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ # Warning.warn() was added in Ruby 2.4.0, so don't use -w on older versions.
10
+ t.ruby_opts = "-w -r./spec/capture_warnings.rb" if RUBY_VERSION >= "2.4.0"
11
+ end
12
+
13
+ task :default => :spec
14
+
15
+ task :generate_changelog do
16
+ sh "github_changelog_generator"
17
+ end
18
+
19
+ task :future_changelog do
20
+ sh "github_changelog_generator --future-release v#{Inq::VERSION}"
21
+ end
22
+
23
+ # Helper functions used later in the Rakefile.
24
+ class HelperFunctions
25
+ def self.freeze_time(&_block)
26
+ date = DateTime.parse("2016-11-01").new_offset(0)
27
+ Timecop.freeze(date) do
28
+ yield
29
+ end
30
+ end
31
+
32
+ def self.generate_report(repository, format)
33
+ require "./spec/vcr_helper.rb"
34
+
35
+ freeze_time do
36
+ report = nil
37
+
38
+ options = {
39
+ repository: repository,
40
+ format: format,
41
+ }
42
+
43
+ cassette = repository.tr("/", "-")
44
+ VCR.use_cassette(cassette) do
45
+ report = Inq.generate_report(**options)
46
+ end
47
+
48
+ filename = "#{cassette}-report.#{format}"
49
+ path = File.expand_path("spec/data/#{filename}", __dir__)
50
+ File.open(path, "w") do |f|
51
+ f.puts report
52
+ # HACK: Trailing newline is missing, otherwise.
53
+ f.puts if format == "html"
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ namespace :generate_reports do
60
+ desc "Generate example HTML reports."
61
+ task :html do
62
+ [
63
+ "how-is/example-repository",
64
+ "how-is/example-empty-repository",
65
+ ].each do |repo|
66
+ HelperFunctions.generate_report(repo, "html")
67
+ end
68
+ end
69
+
70
+ desc "Generate example JSON reports."
71
+ task :json do
72
+ HelperFunctions.generate_report("how-is/example-repository", "json")
73
+ end
74
+
75
+ task :all => [:html, :json]
76
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "inq"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,28 @@
1
+ #!/bin/bash
2
+
3
+ # This script is a fucking tragedy.
4
+
5
+ PROJECT="inq"
6
+
7
+ SCRIPT_DIR="$(dirname $(readlink -f $0))" # Directory this script is in.
8
+ cd "$SCRIPT_DIR/.."
9
+
10
+ LAST_RELEASE="$(git tag --list | cut -d 'v' -f 2 | sort -n | tail -n 1)"
11
+ NEXT_RELEASE=$(cat lib/$PROJECT/version.rb | grep '^\s*VERSION\s*=\s*' | cut -d '"' -f 2)
12
+
13
+ if [ -z "$LAST_RELEASE" ]; then
14
+ echo "error: Could not find latest release using \`git tag --list\`"
15
+ exit 1
16
+ fi
17
+
18
+ if [ -z "$NEXT_RELEASE" ]; then
19
+ echo "error: No version number found in $(pwd)lib/$PROEJCT/version.rb."
20
+ exit 1
21
+ fi
22
+
23
+ if [ "$LAST_RELEASE" == "$NEXT_RELEASE" ]; then
24
+ echo "error: last release (\"$LAST_RELEASE\") and next release (\"$NEXT_RELEASE\") are equivalent."
25
+ exit 1
26
+ fi
27
+
28
+ bundle exec github_changelog_generator --future-release "v$NEXT_RELEASE"
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ status = [
2
+ "FreeBSD",
3
+ "Lint",
4
+ "Linux container:ruby:2.4-alpine",
5
+ "Linux container:ruby:2.5-alpine",
6
+ "Linux container:ruby:2.6-alpine",
7
+ "Windows RUBY_VERSION:2.5.3.101",
8
+ "Windows RUBY_VERSION:2.6.3.1",
9
+ "macOS RUBY_VERSION:2.5",
10
+ "macOS RUBY_VERSION:2.6",
11
+ #"continuous-integration/travis-ci/push",
12
+ #"continuous-integration/appveyor/branch"
13
+ ]
14
+
15
+ # Uncomment this to use a two hour timeout.
16
+ # The default is one hour.
17
+ #timeout_sec = 7200
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require "bundler/setup" # to avoid having to do `bundle exec ...`
6
+ require "inq/sources/ci/travis"
7
+ require "inq/sources/ci/appveyor"
8
+ require "pp"
9
+
10
+ travis = Inq::Sources::CI::Travis.new("rubygems/rubygems", "2018-12-01", "2019-02-01")
11
+ builds = travis.builds
12
+ puts "Number of builds: #{builds.length}"
13
+ puts "First build: #{builds.first['html_url']} (#{builds.first['started_at'].rfc3339})"
14
+ puts "Last build: #{builds.last['html_url']} (#{builds.last['started_at'].rfc3339})"
15
+
16
+ appveyor = Inq::Sources::CI::Appveyor.new("rubygems/rubygems", "2018-12-01", "2019-02-01")
17
+ builds = appveyor.builds
18
+ puts "Number of builds: #{builds.length}"
19
+ puts "First build: #{builds.first['html_url']} (#{builds.first['started_at'].rfc3339})"
20
+ puts "Last build: #{builds.last['html_url']} (#{builds.last['started_at'].rfc3339})"