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

Small Refactoring Changes - First Contribution on Github Open Source #493

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ishansharma1320
Copy link

Hey there!

Ishan here, excited to share my first attempt at applying some Refactoring techniques! I've been looking for ways to practice my skills, and this project caught my eye as the one I'd love to contribute to.

I'm passionate about coding and always looking for ways to improve my craft. Refactoring is a great way to do just that, and I'm thrilled to be able to apply these techniques to this project.

Thanks for taking the time to consider my pull request. I can't wait to see where this project goes and how I can continue to contribute!

Best regards,
Ishan

Copy link

@Freso Freso left a comment

Choose a reason for hiding this comment

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

Note: I am not in any way, shape, or form related to this project and I have absolutely no say in what will and will not be accepted into the repository. I also do not write Java, so I cannot comment on Java language specific things.

That said, I did notice some code style things where your changes deviate from the code style of the surrounding code, which I just wanted to highlight, since this is something you will want to pay attention to regardless of the project/codebase you choose (or get hired) to contribute to in the future.

I point out a lot of specific cases, but I eventually gave up on pointing all of them out. The ones I have pointed out should help you be able to see how your personal coding style differs from the project’s coding style and thus how you should adjust to make your code more palatable for upstream.

Good luck on your free software journey! :)

}


Copy link

Choose a reason for hiding this comment

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

Be mindful of adding extra blank lines if the codebase otherwise separates functions/methods by a single blank line.

Suggested change

this.customDir = null;
this.invalidCustomDir = path.toString();
}
}
Copy link

Choose a reason for hiding this comment

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

Similarly, be mindful of actually adding a blank line to separate methods if that’s what the surrounding/existing code does.

Suggested change
}
}



private static HashMap<String,Boolean> setPossibleChannelType(String[] catSplit, HashMap<String,Boolean> channelType){

Copy link

Choose a reason for hiding this comment

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

Other methods don’t seem to have a blank line at their beginning.

Suggested change

addValidChannel(chan, prepend, result);
}
}
}
Copy link

Choose a reason for hiding this comment

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

Again, whitespace helps readability, esp. if there’s consistency in how they’re used. :)

Suggested change
}
}

Comment on lines -3384 to +3385


Copy link

Choose a reason for hiding this comment

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

What is changed here? Did you change the line ending? It doesn’t look like either line had/has trailing whitespace… ?

private static void getPossibleChannelNames(String channel, boolean prepend, Set<String> result){
String[] channelTypes = new String[]{"noChans","onlyChans","onlyLive"};
HashMap<String,Boolean> channelTypeHM = new HashMap<>();
for(String channelType: channelTypes){
Copy link

Choose a reason for hiding this comment

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

  1. In existing code for and its ( are separated by a space.
  2. In existing code that you’re replacing the Type variable : class uses :.
  3. ){ as mentioned elsewhere.
Suggested change
for(String channelType: channelTypes){
for (String channelType : channelTypes) {

@@ -3381,7 +3382,11 @@ private void checkPointsListen(User user) {
pubsub.listenPoints(user.getStream(), settings.getString("token"));
}
}


private boolean isEventForUserBasedOnScope(String scope, User user){
Copy link

Choose a reason for hiding this comment

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

){

p.invalidCustomDir = null;
p.customInfo = info;
}
p.setCustomValuesForObject(path,info,requireExists);
Copy link

Choose a reason for hiding this comment

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

Existing code uses a space after comma for passing parameters.

Suggested change
p.setCustomValuesForObject(path,info,requireExists);
p.setCustomValuesForObject(path, info, requireExists);


for (int i = 1; i < catSplit.length; i++) {
if (catSplit[i].equals("#")) {
channelType.put("onlyChans",true);
Copy link

Choose a reason for hiding this comment

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

Parameter spaces.

addValidChannel(chan, prepend, result);
}
}
getPossibleChannelNames(channel,prepend,result);
Copy link

Choose a reason for hiding this comment

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

Parameter spaces.

Suggested change
getPossibleChannelNames(channel,prepend,result);
getPossibleChannelNames(channel, prepend, result);

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.

None yet

2 participants