cqfn / pdd

Command line toolkit for collecting TODO markers from your code, known as Puzzle Driven Development (PDD)
https://www.0pdd.com
MIT License
76 stars 25 forks source link

#155: fix bug with github username query #157

Closed mbao01 closed 3 years ago

mbao01 commented 3 years ago

The issue fixed here is due to the following facts:

  1. that empty queries to get a user from github API returns all users with Linus Torvalds as the first user in the list.
  2. some users have their github email as private (see screenshot), therefore their data can't be queried with the email. The fallback is to query with the user's fullname provided that is also defined.

Screenshot:

Screenshot 2021-07-03 at 15 34 48
yegor256 commented 3 years ago

@mbao01 see my comment above. Also, don't forget to run bundle exec rake before submitting PRs.

mbao01 commented 3 years ago

@mbao01 see my comment above. Also, don't forget to run bundle exec rake before submitting PRs.

Thank you, I usually do. It succeeded when I ran on this PR. Did not get any warning on code style.

mbao01 commented 3 years ago

Comments resolved @yegor256

yegor256 commented 3 years ago

@rultor merge

rultor commented 3 years ago

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

rultor commented 3 years ago

@rultor merge

@mbao01 @yegor256 Oops, I failed. You can see the full log here (spent 3min)

Puzzle 125-7d80a284 30/DEV at lib/pdd/rake_task.rb
Puzzle 125-db127bd1 30/DEV at lib/pdd/rake_task.rb
Reading lib/pdd/sources.rb...
Puzzle 98-9de926c6 30/DEV at lib/pdd/sources.rb
Reading lib/pdd/rule/duplicates.rb...
Reading lib/pdd/rule/text.rb...
Reading lib/pdd/rule/roles.rb...
Reading lib/pdd/rule/estimates.rb...
Reading lib/pdd/puzzle.rb...
Reading lib/pdd/version.rb...
Reading lib/pdd.rb...
Reading appveyor.yml...
Reading assets/puzzles.xsd...
Reading assets/puzzles.xsl...
Reading .rubocop.yml...
Puzzle 123-9786ef4c 30/DEV at .rubocop.yml
Reading .gitignore...
Reading pdd.gemspec...
Reading Gemfile.lock...
Reading features/rake.feature...
Reading features/support/env.rb...
Reading features/gem_package.feature...
Reading features/step_definitions/steps.rb...
Reading bin/pdd...
Reading .gitattributes...
+ LC_ALL=US-ASCII
+ bundle exec rake
/home/r/.ruby/gems/minitest-5.5.0/lib/minitest/assertions.rb:413: warning: mismatched indentations at 'ensure' with 'begin' at 404
/home/r/.ruby/gems/minitest-5.5.0/lib/minitest/assertions.rb:452: warning: mismatched indentations at 'ensure' with 'begin' at 437
Run options: --seed 47356

# Running:

\u001b[32m.\u001b[0m\u001b[32m.\u001b[0mNOT IMPLEMENTED
\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[31mERROR\u001b[0m: Puzzle a.txt:1-1 has an estimate of 0 minutes, which is lower than 30 minutes
\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[31mF\u001b[0m

\u001b[31mFailure:
TestSource#test_uses_github_login [/home/r/repo/test/test_source.rb:238]:
Expected: "@yegor256"
  Actual: "test"
\u001b[0m

rails test home/r/repo/test/test_source.rb:223

\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m

Finished in 0.578139s, 76.1062 runs/s, 169.5093 assertions/s.

44 runs, 98 assertions, 1 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /home/r/repo/coverage. 302 / 308 LOC (98.05%) covered.
rake aborted!
Command failed with status (1)
/home/r/.ruby/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/r/.ruby/bin/ruby_executable_hooks:24:in `eval'
/home/r/.ruby/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
container ad372002c422bdd5ed6257d51bb270e4917b7e57dbc7d73e0fbce3ba68d29ae4 is dead
Tue Jul  6 12:52:13 CEST 2021
mbao01 commented 3 years ago

This is weird, no failed test case locally. Could be a timeout from github API. I will retry merge

Screenshot 2021-07-06 at 12 23 52
mbao01 commented 3 years ago

@rultor merge

rultor commented 3 years ago

@rultor merge

@mbao01 Sorry, I accept such requests only from authorized commanders: @yegor256, @0crat, @0pdd Your Github login should be added to the list of "commanders" in .rultor.yml, as explained here

rultor commented 3 years ago

@rultor merge

@mbao01 I'm sorry, I don't understand you :( Check this page and try again please

0crat commented 3 years ago

Are you speaking to me or about me here; you must always start your message with my name if you want to address it to me, see §1

mbao01 commented 3 years ago

@yegor256 please try to merge this again. Look's like a timeout issue with github API.

yegor256 commented 3 years ago

@rultor merge

0crat commented 3 years ago

Are you speaking to me or about me here; you must always start your message with my name if you want to address it to me, see §1

rultor commented 3 years ago

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

rultor commented 3 years ago

@rultor merge

@mbao01 @yegor256 Oops, I failed. You can see the full log here (spent 17s)

+ set -e
+ set -o pipefail
++ dirname ./run.sh
+ cd .
+ echo 1635
+ echo '1.69.1 839260fab'
1.69.1 839260fab
+ date
Wed Jul  7 08:19:05 CEST 2021
+ uptime
 08:19:05 up 282 days, 16:25,  0 users,  load average: 5.09, 4.61, 4.50
+ cat
.rultor.yml in yegor256/home doesn't allow cqfn/pdd to use its assets (there are 110 friends), see http://doc.rultor.com/reference.html#assets
+ exit -1
'cid' file is absent, container wasn't started correctly
rultor commented 3 years ago

@rultor merge

@mbao01 I'm sorry, I don't understand you :( Check this page and try again please

0crat commented 3 years ago

Are you speaking to me or about me here; you must always start your message with my name if you want to address it to me, see §1

rultor commented 3 years ago

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

rultor commented 3 years ago

@rultor merge

@mbao01 @yegor256 Oops, I failed. You can see the full log here (spent 18s)

+ set -e
+ set -o pipefail
++ dirname ./run.sh
+ cd .
+ echo 2356
+ echo '1.69.1 839260fab'
1.69.1 839260fab
+ date
Wed Jul  7 08:23:25 CEST 2021
+ uptime
 08:23:25 up 282 days, 16:29,  0 users,  load average: 4.93, 4.75, 4.58
+ cat
.rultor.yml in yegor256/home doesn't allow cqfn/pdd to use its assets (there are 110 friends), see http://doc.rultor.com/reference.html#assets
+ exit -1
'cid' file is absent, container wasn't started correctly
yegor256 commented 3 years ago

@rultor merge

rultor commented 3 years ago

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

rultor commented 3 years ago

@rultor merge

@mbao01 @yegor256 Oops, I failed. You can see the full log here (spent 3min)

Puzzle 125-7d80a284 30/DEV at lib/pdd/rake_task.rb
Puzzle 125-db127bd1 30/DEV at lib/pdd/rake_task.rb
Reading lib/pdd/sources.rb...
Puzzle 98-9de926c6 30/DEV at lib/pdd/sources.rb
Reading lib/pdd/rule/duplicates.rb...
Reading lib/pdd/rule/text.rb...
Reading lib/pdd/rule/roles.rb...
Reading lib/pdd/rule/estimates.rb...
Reading lib/pdd/puzzle.rb...
Reading lib/pdd/version.rb...
Reading lib/pdd.rb...
Reading appveyor.yml...
Reading assets/puzzles.xsd...
Reading assets/puzzles.xsl...
Reading .rubocop.yml...
Puzzle 123-9786ef4c 30/DEV at .rubocop.yml
Reading .gitignore...
Reading pdd.gemspec...
Reading Gemfile.lock...
Reading features/rake.feature...
Reading features/support/env.rb...
Reading features/gem_package.feature...
Reading features/step_definitions/steps.rb...
Reading bin/pdd...
Reading .gitattributes...
+ LC_ALL=US-ASCII
+ bundle exec rake
/home/r/.ruby/gems/minitest-5.5.0/lib/minitest/assertions.rb:413: warning: mismatched indentations at 'ensure' with 'begin' at 404
/home/r/.ruby/gems/minitest-5.5.0/lib/minitest/assertions.rb:452: warning: mismatched indentations at 'ensure' with 'begin' at 437
Run options: --seed 15769

# Running:

\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[31mERROR\u001b[0m: Puzzle a.txt:1-1 has an estimate of 0 minutes, which is lower than 30 minutes
\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[31mF\u001b[0m

\u001b[31mFailure:
TestSource#test_uses_github_login [/home/r/repo/test/test_source.rb:258]:
Expected: "@yegor256"
  Actual: "test"
\u001b[0m

rails test home/r/repo/test/test_source.rb:243

NOT IMPLEMENTED
\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m

Finished in 0.601026s, 74.8720 runs/s, 169.7098 assertions/s.

45 runs, 102 assertions, 1 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /home/r/repo/coverage. 301 / 306 LOC (98.37%) covered.
rake aborted!
Command failed with status (1)
/home/r/.ruby/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/r/.ruby/bin/ruby_executable_hooks:24:in `eval'
/home/r/.ruby/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
container b5099f5e92deacecb7fdef173dd7d300efda3bff667c141001a43105c7d40c3c is dead
Wed Jul  7 08:29:34 CEST 2021
yegor256 commented 3 years ago

@mbao01 something is wrong with the test here

mbao01 commented 3 years ago

@mbao01 something is wrong with the test here

I could not replicate this failing test locally. Very weird, I'm still investigating the issue

This is the failing test:

Dir.mktmpdir 'test' do |dir|
    raise unless system("
      cd '#{dir}'
      git init --quiet .
      git config user.email yegor256@gmail.com
      git config user.name test
      echo '\x40todo #1 this is the puzzle' > a.txt
      git add a.txt
      git commit --quiet -am 'first version'
    ")
    list = PDD::Source.new(File.join(dir, 'a.txt'), '').puzzles
    assert_equal 1, list.size
    puzzle = list.first
    assert_equal '@yegor256', puzzle.props[:author]
  end

Ideally it should pass (it does locally), this is the response from the request to github.

Screenshot 2021-07-08 at 16 56 45
mbao01 commented 3 years ago

Figured the issue, request rate limitation on github API. I will find a solution.

Screenshot 2021-07-12 at 00 40 27

cc: @yegor256

yegor256 commented 3 years ago

@rultor merge

rultor commented 3 years ago

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

rultor commented 3 years ago

@rultor merge

@yegor256 Done! FYI, the full log is here (took me 3min)

yegor256 commented 3 years ago

@mbao01 thanks!!