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

Code cleanliness improvements #1192

Merged
merged 38 commits into from Aug 18, 2016
Merged

Code cleanliness improvements #1192

merged 38 commits into from Aug 18, 2016

Conversation

@Calvinp
Copy link
Contributor

Calvinp commented Aug 5, 2016

  • Renames most one and two letter variable names to things that are more descriptive.
  • Adds an eslint rule to disallow most one and two letter variable names. id, ui, and s3 are ok because they are useful and informative when they are used, unlike hc (for healthCheck)
  • Adds a block exception to this rule for the moment locale rules.
  • Fixes a spot where props were mutated.
  • Uses moment.updateLocale() instead of moment.locale() to get rid of the deprecated warning.
  • Makes several components functional.
Calvinp added 2 commits Aug 5, 2016
…'ui', and 's3' are ok because they are useful and informative when they are used, unlike 'hc' (for healthchecks)
@Calvinp
Copy link
Contributor Author

Calvinp commented Aug 5, 2016

I always forget to do this... cc @tpetr @kwm4385 @wolfd

@Calvinp Calvinp mentioned this pull request Aug 9, 2016
@Calvinp Calvinp mentioned this pull request Aug 10, 2016
@@ -29,7 +29,7 @@ export default class Duration extends React.Component {
min={0}
step={1}
value={this.props.value ? duration.hours() : ''}
onChange={(e) => this.handleChange(e)}
onChange={(event) => this.handleChange(event)}

This comment has been minimized.

Copy link
@kwm4385

kwm4385 Aug 10, 2016

Contributor

These could probably be shortened just to onChange={this.handleChange}

This comment has been minimized.

Copy link
@Calvinp

Calvinp Aug 10, 2016

Author Contributor

When making this change, I found a bug (that is present in decaf too). I'm working on fixing that.

const Racks = (props) => {
const showUser = (rack) => Utils.isIn(rack.currentState.state, ['ACTIVE', 'DECOMMISSIONING', 'DECOMMISSIONED', 'STARTING_DECOMMISSION']);

const getMaybeReactivateButton = (rack) => (Utils.isIn(rack.currentState.state, ['DECOMMISSIONING', 'DECOMMISSIONED', 'STARTING_DECOMMISSION']) &&

This comment has been minimized.

Copy link
@kwm4385

kwm4385 Aug 10, 2016

Contributor

Might want to split these into their own functions, its difficult to follow what's going on here.


if (pausedRequests.length > 0) {
pausedRequestsSection = (
<UITable
data={pausedRequests}
keyGetter={(r) => r.request.id}
keyGetter={(request) => request.request.id}

This comment has been minimized.

Copy link
@wolfd

wolfd Aug 17, 2016

Contributor

these are actually requestParents, but we don't do a good job of labeling them...

This comment has been minimized.

Copy link
@Calvinp

Calvinp Aug 17, 2016

Author Contributor

Yeah, I'm realizing that. I'm willing to go through and change them all - it's probably worth doing.

@@ -1,7 +1,6 @@
import { createSelector } from 'reselect';
import micromatch from 'micromatch';
import fuzzy from 'fuzzy';
import _ from 'underscore';

This comment has been minimized.

Copy link
@tpetr

tpetr Aug 17, 2016

Member

i'd like to move away from global imports, not towards -- can we add this back?

return a + b;
joinPath(firstPart, secondPart) {
if (!firstPart.endsWith('/')) firstPart += '/';
if (secondPart.startsWith('/')) secondPart = secondPart.substring(1, secondPart.length);

This comment has been minimized.

Copy link
@wolfd

wolfd Aug 17, 2016

Contributor

substring has the second arg optional if you want it to go to the end.

@tpetr tpetr merged commit 1c7a8c3 into decaf Aug 18, 2016
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/travis-ci/push The Travis CI build could not complete due to an error
Details
@tpetr tpetr modified the milestone: 0.10.0 Aug 18, 2016
@ssalinas ssalinas deleted the code_cleanliness_improvements branch Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.