pub icon indicating copy to clipboard operation
pub copied to clipboard

Improve formatting of warnings from pub

Open DartBot opened this issue 9 years ago • 10 comments

<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="96" height="96"hspace="10"> Issue by sigmundch Originally opened as dart-lang/sdk#8630


We might need some additional line-breaks on the formatting of multiple warnings/errors. In the current form, I visually group the last sentence of a warning with the next warning.


Here is an example output today:

Suggestions:

  • Your dependency on "browser" should have a version constraint. For example:      dependencies:     browser: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of browser.
  • Your dependency on "args" should have a version constraint. For example:      dependencies:     args: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of args.
  • Your dependency on "logging" should have a version constraint. For example:      dependencies:     logging: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of logging.
  • Your dependency on "js" should have a version constraint. For example:      dependencies:     js: ">=0.0.16 <0.0.17"      Without a constraint, you're promising to support all future versions of js.
  • Your dependency on "analyzer_experimental" should have a version constraint. For example:      dependencies:     analyzer_experimental: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of analyzer_experimental.

Here is a suggestion for an equivalent warning:

Suggestions:

  • Your dependency on "browser" should have a version constraint. For example:      dependencies:     browser: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of browser.

* Your dependency on "args" should have a version constraint. For example:      dependencies:     args: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of args.

* Your dependency on "logging" should have a version constraint. For example:      dependencies:     logging: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of logging.

* Your dependency on "js" should have a version constraint. For example:      dependencies:     js: ">=0.0.16 <0.0.17"      Without a constraint, you're promising to support all future versions of js.

* Your dependency on "analyzer_experimental" should have a version constraint. For example:      dependencies:     analyzer_experimental: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of analyzer_experimental.


Or even collapse similar warnings:

Suggestions:

  • Your dependency on "browser", "args", "logging", "js", and "analyzer_experimental" should have a version constraint. For example:      dependencies:     browser: ">=0.3.5+1 <0.3.6"     args: ">=0.3.5+1 <0.3.6"     logging: ">=0.3.5+1 <0.3.6"     js: ">=0.0.16 <0.0.17"     analyzer_experimental: ">=0.3.5+1 <0.3.6"      Without a constraint, you're promising to support all future versions of analyzer_experimental.

DartBot avatar Jun 05 '15 22:06 DartBot

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


Added this to the Later milestone. Removed Type-Defect, Priority-Medium, area-pub labels. Added Type-Enhancement, Priority-Low, Area-Pub labels.

DartBot avatar Jun 05 '15 22:06 DartBot

<img src="https://avatars.githubusercontent.com/u/2156198?v=3" align="left" width="48" height="48"hspace="10"> Comment by kasperl


Removed this from the Later milestone. Added Oldschool-Milestone-Later label.

DartBot avatar Jun 05 '15 22:06 DartBot

I think this is stale. Also I'm not exactly sure I understand the differences from before/after.

@sigmundch I think you opened this once - can you give any context?

sigurdm avatar Jan 13 '23 15:01 sigurdm

haha - yeah, seems fair to close this as obsolete. It's only 10 years old :) (at least?)

The markdown formatting above makes the differences hard to see. I believe I originally filed this in a different issue tracker that didn't have markdown, and then the issue has copied a couple times (from that tracker to the SDK, and then here). Below I copied the before/after again with code-blocks. The only difference before/after was an extra new-line after "Without a constraint, you're promising to ....".


At the time this bug was filed the output was:

Suggestions:

* Your dependency on "browser" should have a version constraint. For example:
  
  dependencies:
    browser: ">=0.3.5+1 <0.3.6"
  
  Without a constraint, you're promising to support all future versions of browser.
* Your dependency on "args" should have a version constraint. For example:
  
  dependencies:
    args: ">=0.3.5+1 <0.3.6"
  
  Without a constraint, you're promising to support all future versions of args.
* Your dependency on "logging" should have a version constraint. For example:
  
  dependencies:
    logging: ">=0.3.5+1 <0.3.6"
  
  Without a constraint, you're promising to support all future versions of logging.
* Your dependency on "js" should have a version constraint. For example:
  
  dependencies:
    js: ">=0.0.16 <0.0.17"
  
  Without a constraint, you're promising to support all future versions of js.
* Your dependency on "analyzer_experimental" should have a version constraint. For example:
  
  dependencies:
    analyzer_experimental: ">=0.3.5+1 <0.3.6"
  
  Without a constraint, you're promising to support all future versions of analyzer_experimental.

My recommendation back then was (noticed the extra line separation):

Suggestions:

* Your dependency on "browser" should have a version constraint. For example:
  
  dependencies:
    browser: ">=0.3.5+1 <0.3.6"
  
  Without a constraint, you're promising to support all future versions of browser.

* Your dependency on "args" should have a version constraint. For example:
  
  dependencies:
    args: ">=0.3.5+1 <0.3.6"
  
  Without a constraint, you're promising to support all future versions of args.

* Your dependency on "logging" should have a version constraint. For example:
  
  dependencies:
    logging: ">=0.3.5+1 <0.3.6"
  
  Without a constraint, you're promising to support all future versions of logging.

* Your dependency on "js" should have a version constraint. For example:
  
  dependencies:
    js: ">=0.0.16 <0.0.17"
  
  Without a constraint, you're promising to support all future versions of js.

* Your dependency on "analyzer_experimental" should have a version constraint. For example:
  
  dependencies:
    analyzer_experimental: ">=0.3.5+1 <0.3.6"
  
  Without a constraint, you're promising to support all future versions of analyzer_experimental.

My second recommendation with collapsing:

Suggestions:

Your dependency on "browser", "args", "logging", "js", and "analyzer_experimental" should have a version constraint. For example:
  
  dependencies:
    browser: ">=0.3.5+1 <0.3.6"
    args: ">=0.3.5+1 <0.3.6"
    logging: ">=0.3.5+1 <0.3.6"
    js: ">=0.0.16 <0.0.17"
    analyzer_experimental: ">=0.3.5+1 <0.3.6"
  
Without a constraint, you're promising to support all future versions of "browser", "args", "logging", "js", and "analyzer_experimental".

sigmundch avatar Jan 13 '23 17:01 sigmundch

Thanks for the clarification. I think this issue is still relevant (although probably low priority).

I think collapsing the messages will be a bit difficult, but adding an extra line break between warnings would improve the output.

sigurdm avatar Jan 16 '23 08:01 sigurdm

Hey everyone!! I would like to work on this issue. I just started contributing to open source, could you help me out from where to get started in this issue?

AbhishekSatpathy4848 avatar Feb 02 '23 15:02 AbhishekSatpathy4848

@AbhishekSatpathy4848 Not sure what kind of guidance you are looking for... what have you tried already? Did you download the repo and look around to find if you can see where these messages are produced?

sigurdm avatar Feb 02 '23 16:02 sigurdm

Yeah I could locate the issue in the dependency.dart file, so if I'm not wrong just adding an extra newline character at the end of the message should suffice right?

AbhishekSatpathy4848 avatar Feb 02 '23 18:02 AbhishekSatpathy4848