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

Scala linter and formatter #3357

Merged
merged 4 commits into from
Nov 8, 2018
Merged

Scala linter and formatter #3357

merged 4 commits into from
Nov 8, 2018

Conversation

youri-k
Copy link
Contributor

@youri-k youri-k commented Oct 15, 2018

  • this pr adds:
  • scapegoat as scala linter
  • scalafmt as scala formatter
  • this also adds these steps to the build pipeline

Steps to test:

  • CI should catch everything

Issues:


- [ ] Updated changelog
- [ ] Updated migration guide if applicable
- [ ] Updated documentation if applicable
- [ ] Needs datastore update after deployment

  • Ready for review

@youri-k youri-k self-assigned this Oct 15, 2018
@youri-k
Copy link
Contributor Author

youri-k commented Oct 15, 2018

I let the scalafmt run on the code basis and corrected most linter errors or surpressed them for certain methods, so this is a pretty huge change. I think after the tracing store merge would be a good time to merge this change as there are no other open backend prs.

@fm3
Copy link
Member

fm3 commented Oct 15, 2018

@jstriebel @rschwanhold please have a look at the resulting code style. (1) Do you think it is a good idea to have a formatter in place? And (2), should we change its config?

@fm3
Copy link
Member

fm3 commented Oct 16, 2018

@youri-k can you explain the differences in the snapshots? What happened here / did you fix bugs in the code? How does the user-facing behavior change? Thanks!

_ <- Fox.runOptional(request.identity) { user =>
if (typ == AnnotationType.Task || typ == AnnotationType.Explorational) {
if (typedType == AnnotationType.Task || typedType == AnnotationType.Explorational) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes in the snapshots were necessary because this condition is now checed correctly. Due to this change the annotation snapshot depended on the time between the first and the second call of this route. This time changes from run to run, so it isn't a good idea to check this. The test already implemented a method to replace volatile values, so I added the key tracingTime to be replaced and called it in the specific test. This lead to the changes in the annotation snapshot, where other volatile values are now replaced, too and to the changes in the task snapshot. Regarding the now changed values in the annotation snapshot, I added a check for the annotation id and the skeleton id as they're not volatile in this scenario.
The user-facing doesn't really change except for the fact we may log additional time because of corrected check.

Copy link
Contributor

@rschwanhold rschwanhold left a comment

Choose a reason for hiding this comment

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

LGTM.
The only thing that we could discuss is if we really don't want to use curly brackets around a method that has only one statement:

override def onNotAuthenticated(implicit request: RequestHeader): Future[Result] =
         Future.successful(Unauthorized(Messages("user.notAuthorised")))

This example is pretty obvious, but another example is:

override def routeRequest(request: RequestHeader): Option[Handler] =
if (request.uri.matches("^(/api/|/data/|/assets/).*$")) {
      super.routeRequest(request)
    } else {
      Some(Action { Ok(views.html.main(conf)) })
    }

Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

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

LGTM. Please merge only after tracingstore (#3281 )

@youri-k
Copy link
Contributor Author

youri-k commented Nov 1, 2018

@jstriebel Please take a look as well because this would enforce all backend code to correspond to this style.

Copy link
Contributor

@jstriebel jstriebel left a comment

Choose a reason for hiding this comment

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

Awesome PR!

@youri-k youri-k merged commit 8a24ef2 into master Nov 8, 2018
jfrohnhofen added a commit that referenced this pull request Nov 22, 2018
* master:
  Fix rgb support (#3455)
  Fix docker uid/gid + binaryData permissions. Persist postgres db (#3428)
  Script to merge volume tracing into on-disk segmentation (#3431)
  Hotfix for editing TaskTypes (#3451)
  fix keyboardjs module (#3450)
  Fix guessed dataset boundingbox for non-zero-aligned datasets (#3437)
  voxeliterator now checks if the passed map has elements (#3405)
  integrate .importjs (#3436)
  Re-write logic for selecting zoom level and support non-uniform buckets per dimension (#3398)
  fixing selecting bug and improving style of layout dropdown (#3443)
  refresh screenshots (#3445)
  Reduce the free space between viewports in tracing (#3333)
  Scala linter and formatter (#3357)
  ignore reported datasets of non-existent organization (#3438)
  Only provide shortcut for tree search and not for comment search (#3407)
  Update Datastore+Tracingstore Standalone Deployment Templates (#3424)
  In yarn refresh-schema, also invalidate Tables.scala (#3430)
  Remove BaseDirService that watched binaryData symlinks (#3416)
  Ensure that resolutions array is dense (#3406)
  Fix bucket-collection related rendering bug (#3409)
@normanrz normanrz deleted the linter-formatter-scala branch February 20, 2019 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate Linter and/or Formatter for Scala
5 participants