Skip to content
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

Command refactoring and more #2397

Merged
merged 53 commits into from May 30, 2018
Merged

Command refactoring and more #2397

merged 53 commits into from May 30, 2018

Conversation

bwitham
Copy link
Contributor

@bwitham bwitham commented May 21, 2018

  • collapse multiple commands into a single command; makes commands easier to use and reduces redundant code in some cases:
    • convert commands
    • conflate commands (disable cumulative conflate for now, as its not used)
    • calc tiles commands
    • perty commands
  • add stats for railways

@bwitham bwitham added this to the Hootenanny 2018-05-23 milestone May 21, 2018
@bwitham bwitham self-assigned this May 21, 2018
{
boost::shared_ptr<const MatchComparator> matchComparator =
PertyMatchScorer().scoreMatches(args[0], args[1]);
cout << MapMatchScoringUtils::getMatchScoringString(matchComparator);
Copy link
Collaborator

Choose a reason for hiding this comment

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

MAJOR Replace this usage of "::std::cout" by a logger. rule

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe some other time. Not logging this as a warning b/c that's strange and logging it as info requires updating a lot of regression tests again.

@bwitham
Copy link
Contributor Author

bwitham commented May 29, 2018

@mattjdnv @mschicker A lot of file changes, but this was mostly focused on simplifying the various convert commands into a single command to make it easier to use. There are a few extra things listed in the description that I did along the way. Also, #2416 is a follow on issue that would clean up the convert command even further...decided not to tackle it this time around as it might be fairly involved. thanks.

{
if (Log::getInstance().getLevel() == Log::Info)
{
std::cout << ".";
Copy link
Collaborator

Choose a reason for hiding this comment

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

MAJOR Replace this usage of "::std::cout" by a logger. rule

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pre-existing code from Ogr2OsmCmd

if (Log::getInstance().getLevel() == Log::Info)
{
std::cout << ".";
std::cout.flush();
Copy link
Collaborator

Choose a reason for hiding this comment

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

MAJOR Replace this usage of "::std::cout" by a logger. rule

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pre-existing code from Ogr2OsmCmd


OsmMapReaderFactory readerFactory = OsmMapReaderFactory::getInstance();
if (readerFactory.hasElementInputStream(input) &&
//TODO: this ops restriction needs to be removed and the ops applied during streaming.
Copy link
Collaborator

Choose a reason for hiding this comment

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

INFO Complete the task associated to this "TODO" comment. rule

Copy link
Contributor Author

@bwitham bwitham May 29, 2018

Choose a reason for hiding this comment

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

Don't tell me what TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will be handled in #2416

}
}

void DataConverter::_convertFromOgr(const QStringList inputs, const QString output)
Copy link
Collaborator

Choose a reason for hiding this comment

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

CRITICAL Refactor this function to reduce its Cognitive Complexity from 50 to the 25 allowed. rule

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'm sorry you're not smart enough to understand this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Witham: 1
Dgisbot: 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have to keep that guy in line :-)

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'm learning about cognitive complexity now. They list it as critical and then go on to give example open source projects that have over a thousand instances of it....so, is it really that critical?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pre-existing method from Ogr2OsmCmd; maybe can look into refactoring it into multiple less complex methods at a later date

@@ -52,21 +57,89 @@ class PertyCmd : public BaseCommand

virtual int runSimple(QStringList args)
{
if (args.size() != 2)
LOG_VARD(args.size());
if (args.size() < 2 || args.size() > 3)
{
cout << getHelp() << endl << endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

MAJOR Replace this usage of "::std::cout" by a logger. rule

@dgisbot
Copy link
Collaborator

dgisbot commented May 29, 2018

SonarQube analysis reported 13 issues

  • CRITICAL 1 critical
  • MAJOR 11 major
  • INFO 1 info

Watch the comments in this conversation to review them.

7 extra issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. MAJOR EdgeString.cpp#L65: Remove this block of commented out code. rule
  2. MAJOR EdgeString.cpp#L66: Remove this block of commented out code. rule
  3. MAJOR EdgeString.cpp#L68: Remove this block of commented out code. rule
  4. MAJOR EdgeString.cpp#L69: Remove this block of commented out code. rule
  5. MAJOR EdgeString.cpp#L70: Remove this block of commented out code. rule
  6. MAJOR EdgeString.cpp#L71: Remove this block of commented out code. rule
  7. MAJOR EdgeString.cpp#L72: Remove this block of commented out code. rule

@ngageoint ngageoint deleted a comment from bwitham May 29, 2018
@ngageoint ngageoint deleted a comment from bwitham May 29, 2018
@ngageoint ngageoint deleted a comment from bmarchant May 29, 2018
@ngageoint ngageoint deleted a comment from bwitham May 29, 2018
@ngageoint ngageoint deleted a comment from bwitham May 29, 2018
@bmarchant
Copy link
Contributor

@dgisbot has a mind of its own!
image

@bwitham
Copy link
Contributor Author

bwitham commented May 29, 2018

That's harsh. Silenced by dgisbot...my voice will be heard!

@mattjdnv
Copy link
Contributor

The struggle is real.
First it was Cucumber, now sonarqube.

@bmarchant
Copy link
Contributor

I wonder if we can get SonarQube to only report the actual error findings and not just the code smells. I like the idea of cleaning up some relevant code smells but it isn't necessary to pass the test in my opinion.

Copy link
Contributor

@mschicker mschicker left a comment

Choose a reason for hiding this comment

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

Nice work! Approved! I agree that most of the SonarQube comments, while insightful, should not be addressed at this time.

@bwitham
Copy link
Contributor Author

bwitham commented May 30, 2018

Yeah, I think the best setup would be to have qube report everything in PR's but have the PR only fail on errors and not smells, if that's possible. Then optionally fix smells in the same PR or do it in a later one for the more critical items. We might have to do some adjusting on the priorities on the smells. For instance, qube was calling a large complex method that needed refactoring a critical problem...I would that give that type of thing a lower priority than critical.

@bwitham bwitham merged commit 079d918 into develop May 30, 2018
@bwitham bwitham deleted the 2379 branch May 30, 2018 16:38
@bwitham bwitham restored the 2379 branch May 30, 2018 20:23
@bwitham bwitham deleted the 2379 branch May 30, 2018 20:25
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.

None yet

6 participants