upenn-cis1xx / camelot

A fully-modular OCaml style linter
https://opam.ocaml.org/packages/camelot/
Apache License 2.0
44 stars 5 forks source link

[Bug] 80 col limit triggered multiple times #75

Closed esinx closed 3 years ago

esinx commented 3 years ago

This is such a weird case and I wasn't able to find a clear cause of the issue. The 80 col warning is triggered multiple times under a certain condition. One thing I did find out is that the comment above the long definition is triggering the unexpected behavior (the output is consistent with the expected output once the comments are removed).

To Reproduce Steps to reproduce the behavior:

  1. create file widget.ml with the following content (with comments)
    (*****************************************)
    (**          Additional widgets          *)
    (*****************************************)
    let really_long_name (a: string) (b: string) (c: string) (d: string) (e: string) : string =
    a ^ b ^ c ^ d ^ e
  2. run camelot -f ./widget.ml
  3. Two instances of the identical warning are displayed:
    
    (* ------------------------------------------------------------------------ *)
    File ./widget.ml, line 4, columns: 0-80
    Warning:
        exceeding the 80 character line limit
    You wrote:
         let really_long_name (a: string) (b: string) (c: string) (d: string) (e: string) : string =
    Consider:
        indenting to avoid exceeding the 80 character line limit

( ------------------------------------------------------------------------ ) File ./widget.ml, line 4, columns: 0-80 Warning: exceeding the 80 character line limit You wrote: let really_long_name (a: string) (b: string) (c: string) (d: string) (e: string) : string = Consider: indenting to avoid exceeding the 80 character line limit



**Expected behavior**
Only one of the two warnings should be displayed

**Screenshots**
See output above

**Desktop (please complete the following information):**
 - OS: macOS
 - OCaml version: 4.10.0
 - Dune version : 2.7.0
 - Camelot version : 1.6.0

**Additional context**
As the example suggests, this bug was found while I was working on part 6 of hw05. The original version of the source includes more code than the example above, and camelot raised 28 warnings in that case(when it also should have raised one warning at most).
KeenWill commented 3 years ago

We've seen this bug too and have been working on a fix for this hw. In terms of how it affects you as a student, we might end up grading the line lengths manually this homework so no need to worry about the effect on your score.

esinx commented 3 years ago

seems like #76 fixed it