Skip to content

Refactor path config#128

Merged
kaklakariada merged 13 commits intodevelopfrom
refactor_path_config
Apr 10, 2018
Merged

Refactor path config#128
kaklakariada merged 13 commits intodevelopfrom
refactor_path_config

Conversation

@kaklakariada
Copy link
Copy Markdown
Contributor

Allow configuring a list of paths instead of pattern

@redcatbear
Copy link
Copy Markdown
Collaborator

Please document the whole legacy format and matchers in spec and design document.

Copy link
Copy Markdown
Collaborator

@redcatbear redcatbear left a comment

Choose a reason for hiding this comment

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

Findings in PR.

{
final List<String> patterns = this.config.get().getPathConfigs().stream() //
.map(PathConfig::getPattern) //
.map(PathConfig::getDescription) //
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Variable name says "patterns" yet you see to be collecting "descriptions". Please unify.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✔️

{
return pattern;
}
return GLOB_PREFIX + pattern;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This default behavior should appear in both specification and design.


/**
* Create a new path configuration.
* Create a new pattern based path configuration.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"pattern-based"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✔️

*/
public PathConfig(final String pattern, final String coveredItemArtifactType,
final String coveredItemNamePrefix, final String tagArtifactType)
public static PathConfig createPatternConfig(final String pattern,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Four unnamed arguments. Replace factory method by builder?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✔️

+ ", coveredItemNamePrefix=" + this.coveredItemNamePrefix
+ ", coveredItemArtifactType=" + this.coveredItemArtifactType + ", tagArtifactType="
+ this.tagArtifactType + "]";
return "PathConfig [pathMatcher=" + this.pathMatcher.toString() + ", coveredItemNamePrefix="
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe enclose the comma separated parts in quotes for better readability of the output?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✔️

return this.description;
}

boolean matches(final Path path)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

package scope on purpose?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. DescribedPathMatcher is only used in this package.

Copy link
Copy Markdown
Collaborator

@redcatbear redcatbear Apr 8, 2018

Choose a reason for hiding this comment

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

✔️

this.matcher = matcher;
}

static DescribedPathMatcher createPatternMatcher(final String pattern)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Package scope on purpose?

return new DescribedPathMatcher(fullPattern, patternMatcher);
}

static DescribedPathMatcher createPathListMatcher(final List<Path> paths)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Package scope on purpose?

return GLOB_PREFIX + pattern;
}

String getDescription()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Package scope on purpose?

* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add JavaDoc to all public methods. To package-scoped optionally - but recommended.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is only used internally. Users only work with PathConfig.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✔️

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2018

Codecov Report

Merging #128 into develop will decrease coverage by <.01%.
The diff coverage is 82.6%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #128      +/-   ##
=============================================
- Coverage      92.53%   92.52%   -0.01%     
+ Complexity       814      813       -1     
=============================================
  Files             81       82       +1     
  Lines           2210     2235      +25     
  Branches         196      196              
=============================================
+ Hits            2045     2068      +23     
- Misses           122      125       +3     
+ Partials          43       42       -1
Impacted Files Coverage Δ Complexity Δ
...rter/legacytag/config/LegacyTagImporterConfig.java 100% <ø> (ø) 4 <0> (?)
...rg/itsallcode/openfasttrace/mode/AbstractMode.java 84% <ø> (ø) 6 <0> (ø) ⬇️
...asttrace/importer/legacytag/LegacyTagImporter.java 95.23% <ø> (ø) 11 <0> (ø) ⬇️
...e/importer/legacytag/LegacyTagImporterFactory.java 69.69% <100%> (ø) 10 <0> (ø) ⬇️
...mporter/legacytag/config/DescribedPathMatcher.java 100% <100%> (ø) 8 <8> (?)
...asttrace/importer/legacytag/config/PathConfig.java 69.23% <69.23%> (ø) 4 <4> (?)
...llcode/openfasttrace/core/SpecificationItemId.java 95.49% <0%> (+1.8%) 30% <0%> (+1%) ⬆️

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 6574de7...4b287f2. Read the comment docs.

Copy link
Copy Markdown
Collaborator

@redcatbear redcatbear left a comment

Choose a reason for hiding this comment

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

Changes approved.

@kaklakariada kaklakariada merged commit 9e7c9ab into develop Apr 10, 2018
@kaklakariada kaklakariada deleted the refactor_path_config branch April 10, 2018 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants