Skip to content

Gh897 refactoring extract change status class #1003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

KrivenkoAlexander
Copy link
Contributor

@KrivenkoAlexander KrivenkoAlexander commented Feb 9, 2019

Addressed to #897

@mystamps-bot
Copy link

mystamps-bot commented Feb 9, 2019

1 Message
📖 @KrivenkoAlexander thank you for the PR! All quality checks have been passed! Next step is to wait when @php-coder will review this code

Generated by 🚫 Danger

@php-coder
Copy link
Owner

php-coder commented Feb 9, 2019

@KrivenkoAlexander #1004 has been fixed but it doesn't take an action here because your branch doesn't contain this fix. Could you fetch new changes from my master and rebase your branch on top of updated master? Let me know if you need help with that, but typically these commands work:

$ git checkout master
$ git fetch upstream
$ git merge upstream/master
$ git rebase master  gh897_refactoring_extract_changeStatus_class
$ git push --force-with-lease

Copy link
Owner

@php-coder php-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the pull request!

I left my comments. Also, after rebase, a bot will complain on small issues. Please, take a look and fix them.

@php-coder
Copy link
Owner

Complains from FindBugs you can exclude for now. See example:

<Match>
<Class name="ru.mystamps.web.feature.series.SitemapInfoDto" />
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2" />
</Match>

@KrivenkoAlexander KrivenkoAlexander force-pushed the gh897_refactoring_extract_changeStatus_class branch from a7c1130 to dfee630 Compare February 10, 2019 15:35
@php-coder
Copy link
Owner

@KrivenkoAlexander Could you update master and rebase your branch again, please? I've edited this file also and this change produces a conflict. :-|

*/
package ru.mystamps.web.feature.series.importing;


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove one extra line here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@KrivenkoAlexander KrivenkoAlexander force-pushed the gh897_refactoring_extract_changeStatus_class branch from 47c0b8d to 7b28a38 Compare February 12, 2019 18:40
@php-coder
Copy link
Owner

See errors from codenarc, plus my comments, plus squash all the commits into one (see a link in the message from a bot).

@php-coder
Copy link
Owner

P.S. Please, ping me when it will be ready for review/merge.

@KrivenkoAlexander KrivenkoAlexander force-pushed the gh897_refactoring_extract_changeStatus_class branch from 7b28a38 to 192187c Compare February 13, 2019 10:40
@codecov
Copy link

codecov bot commented Feb 13, 2019

Codecov Report

Merging #1003 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1003      +/-   ##
============================================
+ Coverage     75.95%   75.97%   +0.01%     
  Complexity      487      487              
============================================
  Files            37       37              
  Lines          1539     1540       +1     
  Branches        197      197              
============================================
+ Hits           1169     1170       +1     
  Misses          354      354              
  Partials         16       16
Impacted Files Coverage Δ Complexity Δ
...ture/series/importing/SeriesImportServiceImpl.java 97.89% <100%> (+0.02%) 31 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5cbd398...192187c. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 13, 2019

Codecov Report

Merging #1003 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1003      +/-   ##
============================================
+ Coverage     75.95%   75.97%   +0.01%     
  Complexity      487      487              
============================================
  Files            37       37              
  Lines          1539     1540       +1     
  Branches        197      197              
============================================
+ Hits           1169     1170       +1     
  Misses          354      354              
  Partials         16       16
Impacted Files Coverage Δ Complexity Δ
...ture/series/importing/SeriesImportServiceImpl.java 97.89% <100%> (+0.02%) 31 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5cbd398...248b985. Read the comment docs.

@@ -101,7 +101,7 @@ class SeriesImportServiceImplTest extends Specification {
ex.message == 'User id must be non null'
}

def 'addRequest() should throw exception if url is incorrect'() {
def 'addRequest() should throw exception if url is incorrect'() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you revert the change in this line? Indentation should stay intact.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -367,7 +366,7 @@ class SeriesImportServiceImplTest extends Specification {
IllegalArgumentException ex = thrown()
ex.message == 'Request id must be non null'
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, don't change anything unrelated to your fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still see it there btw.

expectedRequestId,
{ Date date ->
assert DateUtils.roughlyEqual(date, new Date())
1 * seriesImportDao.changeStatus { UpdateImportRequestStatusDbDto status ->
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status ->

Could you remove double space here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

expectedOldStatus,
expectedNewStatus
)
1 * seriesImportDao.changeStatus { UpdateImportRequestStatusDbDto status ->
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to be consistent with other code, could you use brackets so the invocation will look close to the function invocation? It should be fixed in this case and others that you've modified. In other words, please, replace

1 * class.method { Dto dto ->
...
}

by

1 * class.method({ Dto dto ->
...
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did so just to resolve the codenarch violations. Take a look at

CodeNarcRunner [main] DEBUG - results=DirectoryResults(null) [DirectoryResults() [DirectoryResults(ru) [DirectoryResults(ru/mystamps) [DirectoryResults(ru/mystamps/web) [DirectoryResults(ru/mystamps/web/util) [], DirectoryResults(ru/mystamps/web/feature) [DirectoryResults(ru/mystamps/web/feature/series) [DirectoryResults(ru/mystamps/web/feature/series/sale) [], DirectoryResults(ru/mystamps/web/feature/series/importing) [DirectoryResults(ru/mystamps/web/feature/series/importing/sale) [], FileResults(ru/mystamps/web/feature/series/importing/SeriesImportServiceImplTest.groovy) [Violation[rule=ClosureAsLastMethodParameterRule[name=ClosureAsLastMethodParameter, priority=3], lineNumber=321, sourceLine=1 * seriesImportDao.changeStatus ({ UpdateImportRequestStatusDbDto status ->, message=Violation in class ru.mystamps.web.feature.series.importing.SeriesImportServiceImplTest. The last parameter to the 'changeStatus' method call is a closure an can appear outside the parenthesis], Violation[rule=ClosureAsLastMethodParameterRule[name=ClosureAsLastMethodParameter, priority=3], lineNumber=412, sourceLine=1 * seriesImportDao.changeStatus ({ UpdateImportRequestStatusDbDto status ->, message=Violation in class ru.mystamps.web.feature.series.importing.SeriesImportServiceImplTest. The last parameter to the 'changeStatus' method call is a closure an can appear outside the parenthesis], Violation[rule=ClosureAsLastMethodParameterRule[name=ClosureAsLastMethodParameter, priority=3], lineNumber=568, sourceLine=1 * seriesImportDao.changeStatus ({ UpdateImportRequestStatusDbDto status ->, message=Violation in class ru.mystamps.web.feature.series.importing.SeriesImportServiceImplTest. The last parameter to the 'changeStatus' method call is a closure an can appear outside the parenthesis]]]], DirectoryResults(ru/mystamps/web/feature/collection) [], DirectoryResults(ru/mystamps/web/feature/category) [], DirectoryResults(ru/mystamps/web/feature/participant) [], DirectoryResults(ru/mystamps/web/feature/image) [], DirectoryResults(ru/mystamps/web/feature/account) [], DirectoryResults(ru/mystamps/web/feature/country) []], DirectoryResults(ru/mystamps/web/service) []]]]]]

it is saying to me that we have 3 violation .
[INFO] totalPriority1Violations is 0 [INFO] totalPriority2Violations is 0 [INFO] totalPriority3Violations is 3
I am afraid that build won't pass because of it . Am i wrong?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I got it now.

Yes, we have to turn off this warnings with an annotation. See example:

@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see, i've done. Thanks

SeriesImportRequestStatus.PARSING_SUCCEEDED
)
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more extra line should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@php-coder
Copy link
Owner

Some minor formatting issues and I think we I will merge it :) Thank you for your patience!

@KrivenkoAlexander KrivenkoAlexander force-pushed the gh897_refactoring_extract_changeStatus_class branch from 192187c to 248b985 Compare February 13, 2019 12:35
Copy link
Owner

@php-coder php-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you! I'll merge it tonight (with or without 2 tiny whitespace-related changes).

@KrivenkoAlexander
Copy link
Contributor Author

KrivenkoAlexander commented Feb 13, 2019 via email

@php-coder
Copy link
Owner

If you don't mind i will continue to work :)

Yes, sure. Let me know when you will be ready for the next task then.

I need learn groovy a little bit and spock frame work .

Only if it's interested to you because in this project we don't have code that is more complicated than you have seen already.

@php-coder
Copy link
Owner

@KrivenkoAlexander
Copy link
Contributor Author

KrivenkoAlexander commented Feb 13, 2019 via email

@php-coder
Copy link
Owner

Merged in e32b74c commit.

@php-coder
Copy link
Owner

php-coder commented Feb 13, 2019

@KrivenkoAlexander Thank you one more time for the contribution! 🥇

I've added you to the board: https://github.com/php-coder/mystamps/wiki/team-members :)

Also here is the steps to follow after merging PRs: https://github.com/php-coder/mystamps/wiki/after_merge_steps

See you in the next tasks! ;-)

@KrivenkoAlexander KrivenkoAlexander deleted the gh897_refactoring_extract_changeStatus_class branch February 14, 2019 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants