fastruby / skunk

A SkunkScore Calculator for Ruby Code -- Find the most complicated code without test coverage!
https://www.fastruby.io/blog/code-quality/intruducing-skunk-stink-score-calculator.html
MIT License
511 stars 29 forks source link

Implement GPA score #100

Closed JuanVqz closed 1 year ago

JuanVqz commented 2 years ago

Description:

I'm trying to solve #95 following the GPA (grade point average) score but the example there used the 4.0 scale and I'm not pretty sure if we want that.

Closes #95

If changes to the behavior are made, clearly describe what changes.

I will abide by the code of conduct.

codecov[bot] commented 2 years ago

Codecov Report

Merging #100 (b3ed527) into main (733dd4f) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #100   +/-   ##
=======================================
  Coverage   98.27%   98.27%           
=======================================
  Files          25       25           
  Lines         463      463           
=======================================
  Hits          455      455           
  Misses          8        8           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

JuanVqz commented 2 years ago

Have a question, are we interested on have different types of A+, A, A- (and so on) in the report? will be useful or it is confusing?

The range that I used was found on the internet but it will be great if you can confirm that it is the correct one.

Ex. of a simplified version.

# |Letter Grade | Percent Grade | Scale |
# |:------------|:-------------:|------:|
# | A           | 0-69          | 4.0   |
# | B           | 70-79         | 3.0   |
# | C           | 80-89         | 2.0   |
# | D           | 90-96         | 1.0   |
# | E/F         | 97-INFINITY   | 0.0   |

      def score
        case @skunk_score
        when (0..69)
          "A"
        when (70..79)
          "B"
        when (80..89)
          "C"
        when (90..96)
          "D"
        when (97..Float::INFINITY)
          "E"
        end
      end

I haven't fixed the linter because we may modify the logic there.

terrainoob commented 2 years ago

Hey guys! Loving this idea! @etagwerker requested some real world results to work against, so here's the top 20 scores from a recent run at our place (sans the file names). We literally have hundreds of files this runs against, so if you need deeper data, let me know!

| 1390.66 | 76.41 | 5 | 15.28 | 9.8 | | 1355.68 | 76.16 | 5 | 15.23 | 11.63 | | 1020.83 | 68.82 | 6 | 11.47 | 11.11 | | 874.88 | 17.5 | 2 | 8.75 | 0.0 | | 874.88 | 26.25 | 3 | 8.75 | 0.0 | | 864.12 | 17.28 | 2 | 8.64 | 0.0 | | 817.34 | 33.14 | 3 | 11.05 | 26.32 | | 801.52 | 56.11 | 7 | 8.02 | 0.0 | | 725.8 | 14.52 | 2 | 7.26 | 0.0 | | 678.84 | 20.37 | 3 | 6.79 | 0.0 | | 676.13 | 338.07 | 21 | 16.1 | 58.93 | | 669.34 | 148.74 | 8 | 18.59 | 64.81 | | 631.64 | 227.81 | 22 | 10.35 | 39.18 | | 627.41 | 52.28 | 5 | 10.46 | 40.85 | | 571.0 | 74.23 | 13 | 5.71 | 0.0 | | 560.51 | 14.01 | 2 | 7.01 | 20.75 | | 521.72 | 111.8 | 12 | 9.32 | 44.68 | | 465.3 | 1035.28 | 89 | 11.63 | 60.38 | | 455.42 | 218.22 | 23 | 9.49 | 52.78 | | 430.63 | 46.81 | 5 | 9.36 | 54.55 |

etagwerker commented 1 year ago

are we interested on have different types of A+, A, A- (and so on) in the report? will be useful or it is confusing?

@JuanVqz I don't think we are interested in this at the moment:

JuanVqz commented 1 year ago

are we interested on have different types of A+, A, A- (and so on) in the report? will be useful or it is confusing?

@JuanVqz I don't think we are interested in this at the moment:

I'm going to close this pr, I think we give it a shot later, thanks @etagwerker