DESCRIPTION

Added check for warnings and errors before commit

Bug: 475559
Change-Id: I352c33d0fed1b610babda2992c6b1b211952dfb2
Signed-off-by: Reilly Hart xxx@xxx.xxx
Signed-off-by: Jayvion Booth xxx@xxx.xxx

COMMENTS

author: Reilly Hart
date: 2015-09-07 09:38:07.000000000

Uploaded patch set 9.

-------------------------------------
author: Brenden Conley
date: 2015-09-07 10:14:31.000000000

Patch Set 9:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/7560/

-------------------------------------
author: Brenden Conley
date: 2015-09-07 10:36:24.000000000

Patch Set 9: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/7560/ : SUCCESS

-------------------------------------
author: Reilly Hart
date: 2015-09-07 12:23:15.000000000

Patch Set 9: Code-Review+1

-------------------------------------
author: Douglas Trujillo
date: 2015-09-07 12:37:38.000000000

Patch Set 9: Code-Review-1

Changing the option "Check for warnings/errors" using the preference editor now is correctly reflected in staging view when clicking "Apply" or "Finish".

If this option is switched on I can switch it off locally in the staging view by clicking "Ignore warnings and errors". But this isn't persisted immediately and not reflected in the preference so I can reach the inconsistent state shown in http://i.imgur.com/ib38UKp.png.

As I said in an earlier comment this breaks the rule that option changes for Eclipse views should be always persisted immediately. Only editors (including preference editors) should have a dirty state. Please fix this as this non-standard behavior will likely confuse the users.

-------------------------------------
author: Reilly Hart
date: 2015-09-07 15:02:42.000000000

Patch Set 9:

Is this how you want it to work?
I ask, because I want to be sure. For my understanding the preference could be set only via preference editor and the 'ignore warning and errors' checkbox appears only when the preference is set as true. It shouldn't set the preference (in my opinion), because in ideal world no file with errors/warnings should be commited, but sometimes there's an error/warning in project that has been there for ages and everybody is afraid to touch it so you're aware of that and commit with your changes without touching the rest. So normally I've got preference set to check errors/warnings and the checkbox unticked, but for 1 commit per week i'll tick the 'ignore warnings errors' checkbox, because I have to. For me it shouldn't be persisted. If you want it done your way, it's ok

-------------------------------------
author: Jayvion Booth
date: 2015-09-07 18:45:10.000000000

Patch Set 9:

> Changing the option "Check for warnings/errors" using the
 > preference editor now is correctly reflected in staging view when
 > clicking "Apply" or "Finish".
 > 
 > If this option is switched on I can switch it off locally in the
 > staging view by clicking "Ignore warnings and errors". But this
 > isn't persisted immediately and not reflected in the preference so
 > I can reach the inconsistent state shown in http://i.imgur.com/ib38UKp.png.
 > 
 > As I said in an earlier comment this breaks the rule that option
 > changes for Eclipse views should be always persisted immediately.
 > Only editors (including preference editors) should have a dirty
 > state. Please fix this as this non-standard behavior will likely
 > confuse the users.

I second to Pawel think this checkbox schould not persist the state but only work for the current commit.

I think I would not like this option to be persisted from the view or commit dialog, since after first use the warning will never be shown again.

Might be we can reword the message to indicate the fact that this state is not persisted, and show something like: "Mute warnings for now" or "Ignore warnings for this commit"?

Another solution would be to put a text *link* link at the end of the warning message which would open the preferences, and don't offer checkbox at all?

What I can imagine is that people would definitely love this check for errors but hate for warnings. No one commits code with compile errors bit we have lot of legacy code with warnings. So might be we also should have 2 pereferences, which user can turn on/off, and so offering one checkbox will not make everyone happy, and tho checkboxes are too much.

What about to always show the warning message but not always disable commit bittons? So instead of the checkbox show 

"Staged files contain errors or warnings. Commit not allowed. Configure..."

or 

"Staged files contain errors or warnings. Configure..."

And options would be radio-boxes, something like

"If files to commit have warnings or errors":
* "Allow commit with warnings and errors"
* "Allow commit if files have warnings"
* "Allow commit but show warning message"
* "Don't allow commit"
* "Never check for warnings or errors"

-------------------------------------
author: Reilly Hart
date: 2015-09-07 18:58:58.000000000

Patch Set 9: -Code-Review

I wanted to implement such a feature, because I used to commit some files with trash like unused local variables, however I approve with Andrey, because it's more general and we do it for the users. I think that it would be also nice to be able to configure those options that Andrey wrote for particular repo. Like in general no warnings/errors are allowed, but for project X warnings are just fine, because it's legacy code with some warnings that I would not like to touch.

-------------------------------------
author: Douglas Trujillo
date: 2015-09-07 23:16:02.000000000

Patch Set 9:

> > Changing the option "Check for warnings/errors" using the
 > > preference editor now is correctly reflected in staging view when
 > > clicking "Apply" or "Finish".
 > >
 > > If this option is switched on I can switch it off locally in the
 > > staging view by clicking "Ignore warnings and errors". But this
 > > isn't persisted immediately and not reflected in the preference
 > so
 > > I can reach the inconsistent state shown in http://i.imgur.com/ib38UKp.png.
 > >
 > > As I said in an earlier comment this breaks the rule that option
 > > changes for Eclipse views should be always persisted immediately.
 > > Only editors (including preference editors) should have a dirty
 > > state. Please fix this as this non-standard behavior will likely
 > > confuse the users.
 > 
 > I second to Pawel think this checkbox schould not persist the state
 > but only work for the current commit.
 > 
 > I think I would not like this option to be persisted from the view
 > or commit dialog, since after first use the warning will never be
 > shown again.
 > 
 > Might be we can reword the message to indicate the fact that this
 > state is not persisted, and show something like: "Mute warnings for
 > now" or "Ignore warnings for this commit"?
 
now I get what you want, rewording the message would definitively help to
avoid my misunderstanding

 > Another solution would be to put a text *link* link at the end of
 > the warning message which would open the preferences, and don't
 > offer checkbox at all?
 
I think providing a quick way to override general preference makes sense
if it's clear what's the difference. If it's one-time override we should
maybe reset it to non-override after next commit is created

 > What I can imagine is that people would definitely love this check
 > for errors but hate for warnings. No one commits code with compile
 > errors bit we have lot of legacy code with warnings. So might be we
 > also should have 2 pereferences, which user can turn on/off, and so
 > offering one checkbox will not make everyone happy, and tho
 > checkboxes are too much.
 > 
 > What about to always show the warning message but not always
 > disable commit bittons? So instead of the checkbox show
 > 
 > "Staged files contain errors or warnings. Commit not allowed.
 > Configure..."
 > 
 > or
 > 
 > "Staged files contain errors or warnings. Configure..."
 > 
 > And options would be radio-boxes, something like
 > 
 > "If files to commit have warnings or errors":
 > * "Allow commit with warnings and errors"
 > * "Allow commit if files have warnings"
 > * "Allow commit but show warning message"
 > * "Don't allow commit"
 > * "Never check for warnings or errors"

I like the idea, I'd allow to configure if warning should be shown if there are warnings or errors,
and allow to configure if this blocks commit button. I would use checkboxes
instead of radio buttons then we don't need to spell out all permutations

 Warn if there are
 - warnings
 - errors
 Block commit if there are
 - warnings
 - errors

-------------------------------------
author: Jayvion Booth
date: 2015-09-08 07:00:17.000000000

Patch Set 9:

> > Might be we can reword the message to indicate the fact that this
 > > state is not persisted, and show something like: "Mute warnings
 > for
 > > now" or "Ignore warnings for this commit"?
 > 
 > now I get what you want, rewording the message would definitively
 > help to
 > avoid my misunderstanding
 
So the checkbox should be "Ignore errors/warnings for this commit"? Any other proposals?

 > I like the idea, I'd allow to configure if warning should be shown
 > if there are warnings or errors,
 > and allow to configure if this blocks commit button. I would use
 > checkboxes
 > instead of radio buttons then we don't need to spell out all
 > permutations
 > 
 > Warn if there are
 > - warnings
 > - errors
 > Block commit if there are
 > - warnings
 > - errors

I like your proposal, but let us use checkbox *and* combos in two blocks:

[x] Warn if there are: <combo with 2 choices>
 [errors]
 [warnings and errors] (default)

Next is *indented* block, disabled if the parent "Warn" checkbox is disabled:

   [x] Block commit if there are: <combo>
     [errors] (default)
     [warnings and errors]

So we end up with 4 preferences:

1) commit_show_warning: true/false, default is true

2) commit_show_warning_type: "warnings_and_errors" / "errors", default is "warnings_and_errors"

3) commit_block: true/false, default is true

4) commit_block_type: "warnings_and_errors" / "errors", default is "errors"

If the "commit_show_warning" is selected, this should automatically enable "commit_block", and if it is unchecked, it should disable "commit_block". The reason is that we don't want to *silently* block commit.

Pawel: although I agree that different projects can have different policies, I would not make those preferences project related yet, simply because this will be a little bit complicated since in one repository we can have multiple differently configured projects. We can add this later.

Pawel, you have to change the logic a little bit to differentiate:
* we can show message but do not disable the dialog
* the message can be shown for errors only or for errors and warnings
* buttons can be sdisabled for errors only or for errors and warnings

-------------------------------------
author: Douglas Trujillo
date: 2015-09-08 07:08:38.000000000

Patch Set 9:

> > > Might be we can reword the message to indicate the fact that
 > this
 > > > state is not persisted, and show something like: "Mute warnings
 > > for
 > > > now" or "Ignore warnings for this commit"?
 > >
 > > now I get what you want, rewording the message would definitively
 > > help to
 > > avoid my misunderstanding
 > 
 > So the checkbox should be "Ignore errors/warnings for this commit"?
 > Any other proposals?
 
looks good to me

 > > I like the idea, I'd allow to configure if warning should be
 > shown
 > > if there are warnings or errors,
 > > and allow to configure if this blocks commit button. I would use
 > > checkboxes
 > > instead of radio buttons then we don't need to spell out all
 > > permutations
 > >
 > > Warn if there are
 > > - warnings
 > > - errors
 > > Block commit if there are
 > > - warnings
 > > - errors
 > 
 > I like your proposal, but let us use checkbox *and* combos in two
 > blocks:
 > 
 > [x] Warn if there are: <combo with 2 choices>
 > [errors]
 > [warnings and errors] (default)
 > 
 > Next is *indented* block, disabled if the parent "Warn" checkbox is
 > disabled:
 > 
 > [x] Block commit if there are: <combo>
 > [errors] (default)
 > [warnings and errors]
 
+1

 > So we end up with 4 preferences:
 > 
 > 1) commit_show_warning: true/false, default is true
 > 
 > 2) commit_show_warning_type: "warnings_and_errors" / "errors",
 > default is "warnings_and_errors"
 > 
 > 3) commit_block: true/false, default is true
 > 
 > 4) commit_block_type: "warnings_and_errors" / "errors", default is
 > "errors"
 > 
 > If the "commit_show_warning" is selected, this should automatically
 > enable "commit_block", and if it is unchecked, it should disable
 > "commit_block". The reason is that we don't want to *silently*
 > block commit.
 
+1

 > Pawel: although I agree that different projects can have different
 > policies, I would not make those preferences project related yet,
 > simply because this will be a little bit complicated since in one
 > repository we can have multiple differently configured projects. We
 > can add this later.
 > 
 > Pawel, you have to change the logic a little bit to differentiate:
 > * we can show message but do not disable the dialog
 > * the message can be shown for errors only or for errors and
 > warnings
 > * buttons can be sdisabled for errors only or for errors and
 > warnings

-------------------------------------
author: Reilly Hart
date: 2015-09-08 08:30:02.000000000

Patch Set 9:

I'll start rewworking this change then

-------------------------------------
author: Gerrit Johnathan Pham
date: 2015-09-11 23:59:01.000000000

Change has been successfully merged into the git repository by Douglas Trujillo

-------------------------------------
