microsoft / hyperspace

An open source indexing subsystem that brings index-based query acceleration to Apache Spark™ and big data workloads.
https://aka.ms/hyperspace
Apache License 2.0
424 stars 115 forks source link

Reformat files with scalafmt #473

Closed clee704 closed 3 years ago

clee704 commented 3 years ago

What is the context for this pull request?

What changes were proposed in this pull request?

Reformat files with scalafmt, as in the following command:

$ scalafmt -c dev/.scalafmt.conf src

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Unit test

paryoja commented 3 years ago

$ scalafmt -c dev/.scalafmt.conf src

What if we add this command to pre-commit hook? Every committers should set their environment to use pre-commit hook so it cannot be mandatory though.

clee704 commented 3 years ago

I think we can add a guideline in README or somewhere regarding scalafmt, and a git hook is a good one. There can be other ways, though, like running scalafmt automatically in your IDE or vim (using coc-metals).

It would be nice if we can configure scalastyle or use some other ways to check the formatting automatically during the build and CI.

clee704 commented 3 years ago

Seems we can use sbt-scalafmt to check the formatting. What do you think about adding the check to the build or CI to enforce the formatting? @imback82 @sezruby

paryoja commented 3 years ago

I think we can add a guideline in README or somewhere regarding scalafmt

I mentioned to use 'reformat on save' in the formatting guild committed in #471 but it wasn't obligation so I wonder how many committers read it carefully and set it :(

sbt-scalafmt could be good. It is the project mentioned in the scalafmt guide. https://scalameta.org/scalafmt/docs/installation.html

clee704 commented 3 years ago

Opened #476 for enforcing/checking scalafmt during build/CI