Skip to content

Conversation

@WillardHu
Copy link
Contributor

What's the purpose of this PR

  • Inline variable
  • Chenge deprecated method
  • Add final or static final keyword to class field

Which issue(s) this PR fixes:

Fixes #

Brief changelog

fixed some code smells

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

@github-actions
Copy link

github-actions bot commented Sep 9, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@WillardHu
Copy link
Contributor Author

/recheck

@WillardHu
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@WillardHu
Copy link
Contributor Author

/recheck


private static final Gson GSON = new Gson();
private static Type type = new TypeToken<Map<String, String>>() {}.getType();
private static Type TYPE = new TypeToken<Map<String, String>>() {}.getType();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private static Type TYPE = new TypeToken<Map<String, String>>() {}.getType();
private static final Type TYPE = new TypeToken<Map<String, String>>() {}.getType();

Comment on lines 48 to 50
/**
* Created by qianjie on 8/10/17.
*/
Copy link
Member

Choose a reason for hiding this comment

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

Remove this

public List<OpenAppDTO> findApps(@RequestParam(value = "appIds", required = false) String appIds) {
final List<App> apps = new ArrayList<>();
if (StringUtils.isEmpty(appIds)) {
if (StringUtils.hasLength(appIds)) {
Copy link
Member

Choose a reason for hiding this comment

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

The logical result is reversed, which is wrong

Suggested change
if (StringUtils.hasLength(appIds)) {
if (!StringUtils.hasLength(appIds)) {

kezhenxu94
kezhenxu94 previously approved these changes Sep 9, 2021
@WillardHu
Copy link
Contributor Author

WillardHu force-pushed the WillardHu:fix/code-smells branch from 80716c6 to b66b78b 21 seconds ago

rebase master and retest with jdk8 unit-test

@WillardHu WillardHu requested a review from kezhenxu94 September 9, 2021 09:52
kezhenxu94
kezhenxu94 previously approved these changes Sep 9, 2021
Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

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

LGTM

@WillardHu
Copy link
Contributor Author

WillardHu force-pushed the WillardHu:fix/code-smells branch from b66b78b to 0f95412 2 minutes ago

Fixed the ConsumerAuditUtil becuse ConsumerAuditUtilTest used reflection to set BATCH_TIMEOUT and BATCH_TIMEUNIT, so without final. Passed unit-test in local.

@WillardHu WillardHu requested a review from kezhenxu94 September 9, 2021 11:09
@codecov-commenter
Copy link

Codecov Report

Merging #3968 (0f95412) into master (ec9534f) will decrease coverage by 0.03%.
The diff coverage is 53.84%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3968      +/-   ##
============================================
- Coverage     50.80%   50.77%   -0.04%     
+ Complexity     2467     2466       -1     
============================================
  Files           475      475              
  Lines         14608    14603       -5     
  Branches       1523     1523              
============================================
- Hits           7422     7414       -8     
  Misses         6660     6660              
- Partials        526      529       +3     
Impacted Files Coverage Δ
...o/openapi/filter/ConsumerAuthenticationFilter.java 94.11% <ø> (ø)
...enapi/v1/controller/NamespaceBranchController.java 14.28% <ø> (ø)
...ramework/apollo/openapi/util/OpenApiBeanUtils.java 8.95% <20.00%> (+0.13%) ⬆️
...rk/apollo/openapi/v1/controller/AppController.java 42.30% <33.33%> (-2.14%) ⬇️
...mework/apollo/openapi/service/ConsumerService.java 53.38% <100.00%> (-0.78%) ⬇️
...amework/apollo/openapi/util/ConsumerAuditUtil.java 91.66% <100.00%> (+2.47%) ⬆️
...rk/apollo/spring/property/SpringValueRegistry.java 83.78% <0.00%> (-5.41%) ⬇️
.../framework/apollo/spring/property/SpringValue.java 87.71% <0.00%> (-1.76%) ⬇️
.../apollo/internals/RemoteConfigLongPollService.java 77.10% <0.00%> (-1.21%) ⬇️

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 ec9534f...0f95412. Read the comment docs.

@kezhenxu94 kezhenxu94 merged commit cd44503 into apolloconfig:master Sep 9, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Sep 9, 2021
@WillardHu WillardHu deleted the fix/code-smells branch September 9, 2021 14:02
@nobodyiam nobodyiam added this to the 1.10.0 milestone Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants