errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.4k stars 150 forks source link

metric styles don't seem to work with 2.13.0 #396

Closed ryandaugherty7 closed 2 years ago

ryandaugherty7 commented 2 years ago

Thanks so much for adding metric styles, as this is exactly what my team is looking for.

I can get other styles to work great locally, however running the metric styles in the Readability repo (https://github.com/errata-ai/readability/releases) seem to be giving me bad results. I've tried to adjust the config and some of the styles, but nothing seems to work.

I have a file named markdowntest.md with this content:

The frog jumped on the stool. 

They were a gloomy suite of rooms, in a lowering pile of building up a yard, where it had so little business to be, that one could scarcely help fancying it must have run there when it was a young house, playing at hide-and-seek with other houses, and forgotten the way out again.

Further support for the view that educational expansion would reduce inequality was derived from the dualistic nature of developing societies. The economic structures of developing societies were said to consist of two sectors: a traditional sector that uses little capital, is relatively unproductive, does not require an educated labor force, and places a great emphasis on subsistence farming, small workshops and small commercial enterprises; a modern sector that uses advanced technology and capital, is far more productive, and requires a labor force with at least some schooling.

As he crossed toward the pharmacy at the corner he involuntarily turned his head because of a burst of light that had ricocheted from his temple, and saw, with that quick smile with which we greet a rainbow or a rose, a blindingly white parallelogram of sky being unloaded from the van—a dresser with mirrors across which, as across a cinema screen, passed a flawlessly clear reflection of boughs sliding and swaying not arboreally, but with a human vacillation, produced by the nature of those who were carrying this sky, these boughs, this gliding façade.

The results from running vale markdowntest.md at the command line are:

markdowntest.md
 1:1  warning  Try to keep the Flesch reading  Readability.FleschReadingEase    
               ease score (23.12) above 70.                                     
 1:1  warning  Try to keep the Gunning-Fog     Readability.GunningFog           
               index (24.44) below 10.                                          
 1:1  warning  Try to keep the LIX score       Readability.LIX                  
               (73.80) below 35.                                                
 1:1  warning  Try to keep the Coleman–Liau    Readability.ColemanLiau          
               Index grade (12.15) below 19.                                    
 1:1  warning  Try to keep the Flesch–Kincaid  Readability.FleschKincaid        
               grade level (22.16) below 8.                                     
 1:1  warning  Try to keep the Automated       Readability.AutomatedReadability 
               Readability Index (25.84)                                        
               below 8.                                                         
 1:1  warning  Try to keep the SMOG grade      Readability.SMOG                 
               (18.03) below 10.

All the checks are all coming back at line 1, position 1. If I delete the first sentence (grade 5 according to an online Flesch–Kincaid calculator) it gives different results, but they are all at 1:1, and not at other lines in the file.

The contents of my .vale.ini is:

# Vale configuration file.
#
# For more information, see https://errata-ai.gitbook.io/vale/getting-started/configuration.

StylesPath = styles
MinAlertLevel = suggestion

[*.{md,txt}]
BasedOnStyles = Readability

Here is my setup:

Thanks! I really appreciate your help on this.

jdkato commented 2 years ago

The 1:1 location is returned for all rules that use the summary scope.

In other words, since the metric extension point uses the full document to perform its calculations, so there's no meaningful way to provide a more specific file location.

ryandaugherty7 commented 2 years ago

Ah I knew I was missing something. Thanks!

Are there any plans to allow other scopes for this? I would be nice to be able to do this at the paragraph or sentence level to pinpoint these warnings.

jdkato commented 2 years ago

Not currently.

The extension point is really designed to be used at the document level since its variables include both sentences and paragraphs themselves.