github-actions
released this
11 Oct 21:23
·
149 commits
to refs/heads/main
since this release
Verifying against public repositories
This release fixes issue #4133 and introduces a large number of fixes which address formatting issues discovered while testing the formatter against a set of public repositories, and adds these checks with every commit.
- CommunitySuite: add Intellij Scala plugin code (#4436) @kitbellew
- CommunitySuite: check the total states visited (#4429) @kitbellew
- CommunitySuite: remove some versions (#4418) @kitbellew
- CommunitySuite: add versions of playframework (#4414) @kitbellew
- CommunitySuite: remove maxStateVisits override (#4390) @kitbellew
- CommunitySuite: add versions of zio (#4407) @kitbellew
- CommunitySuite: allow selecting a subset of styles (#4393) @kitbellew
- CommunitySuite: add versions of Akka (#4391) @kitbellew
- CommunityBuild: add
fileOverride
parameter (#4388) @kitbellew - CommunityBuild:
excluded
as PathMatcher patterns (#4385) @kitbellew - CommunitySuite: add versions of scalaz (#4380) @kitbellew
- CommunitySparkSuite: add spark v3.5.3 (#4378) @kitbellew
- CommunitySuite: set longpaths in clone directory (#4376) @kitbellew
- CommunitySuite: test scala.js version 1.17.0 (#4373) @kitbellew
- CommunitySparkSuite: add more spark versions (#4360) @kitbellew
- CommunitySuite: add tests for spark versions (#4358) @kitbellew
- CommunitySuite: check out projects under target/ (#4348) @kitbellew
- CommunitySuite: add tests for scala-cli versions (#4347) @kitbellew
- CommunityTests: split into separate projects (#4346) @kitbellew
- CommunityRepoSuite: add common abstract superclass (#4345) @kitbellew
- CommunitySuite: print git ref and scalafmt style (#4344) @kitbellew
- CommunitySuite: add tests for scala3 versions (#4342) @kitbellew
- CommunitySuite: add tests for scala2 versions (#4341) @kitbellew
- CommunitySuite: create directory, ignore if exists (#4343) @kitbellew
- CommunitySuite: support excluding some styles (#4340) @kitbellew
- CommunityBuild: test community-code formatting (#4256) @kitbellew
Features
- ProjectFiles: add
.mill
to the default glob list (#4412) @kitbellew - NamedDialect: add all scala3 dialects (#4382) @kitbellew
- Allow to compile with Scala Native (#4325) @jchyb
- Separate regex patterns to jvm-only directory in preparation for Scala Native (#4309) @jchyb
- Prepare the build for cross compilation by renaming jvm sources (#4282) @jchyb
- Update libraries needed for cross compilation with Scala Native (#4283) @jchyb
- Replace java reflection with a macro-based solution (#4280) @jchyb
- Add literal.binPrefix setting to format binary literals. (#4183) @charpov
Bug fixes
- Router: apply space.inParens consistently (#4431) @kitbellew
- Router: no NL after
<-
in()
enums for scala3 (#4416) @kitbellew - Router: no conflict b/w preferNoSplit/skipNoSplit (#4415) @kitbellew
- Rewrite: remove one NL even if found many (#4413) @kitbellew
- Router: don't compare Option and Binpack.Site (#4320) @kitbellew
- CliOptions: write info to console instead of err (#4272) @kitbellew
- CliOptions: turn info into a stream+writer wrapper (#4271) @kitbellew
- ScalafmtCliReporter: use info for downloader (#4270) @kitbellew
- CliOptionsTest: expand, add tests, use System.out (#4269) @kitbellew
- CliOptions: clean-up determining when out is used (#4268) @kitbellew
- CliOptions: move NoopOutputStream to new Output (#4267) @kitbellew
- ScalafmtCoreRunner: print stack trace to stderr (#4266) @kitbellew
- Router: allow breaks in any double-quote strings (#4254) @kitbellew
- Scala3 syntax: remove braces around single import (#4223) @kitbellew
- ConfParsed: catch any runaway errors and wrap (#4208) @kitbellew
- ScalafmtDynamicSession: check config has a parent (#4185) @kitbellew
- Router: restore Shebang token handling (#4120) @kitbellew
- RedudantParens: generalize unary-literal check (#4119) @kitbellew
- RedundantParens: don't rewrite unary within select (#4118) @kitbellew
- RedundantParens: don't rewrite
Init
(#4124) @kitbellew
Miscellaneous
- Router: inline, remove TreeOps.findTemplate (#4433) @kitbellew
- Split/Modification: slightly change
toString()
(#4432) @kitbellew - LoggerOps: log optional token (#4361) @kitbellew
- Use new tree/token implicit extensions (#4322) @kitbellew
- ScalafmtDynamicError: include cause (#4313) @kitbellew
- Debug: capture and log routes (splits) (#4294) @kitbellew
- LoggerOps: add option to do no logging (#4289) @kitbellew
- Debug: don't assume completed state after
start
(#4288) @kitbellew - Split: keep 2 instances of FileLine, for debugging (#4273) @kitbellew
- Un'SKIP' tests which have been fixed previously (#4224) @kitbellew
- Debug: improve reporting visited tokens (#4221) @kitbellew
- ManualTests: re-use "ONLY" from HasTests (#4207) @kitbellew
Dependency and build updates
- Scalameta: upgrade to v4.10.2 (#4434) @kitbellew
- Workflows: change
master
tomain
(#4401) @kitbellew - SBT: upgrade scala 2.13 to patch 15 (#4324) @kitbellew
- Scalameta: upgrade to v4.10.1 (#4323) @kitbellew
- Scalameta: upgrade to v4.10.0 (#4321) @kitbellew
- Update sbt to 1.10.2 (#4305) @scalameta-bot
- Update munit to 1.0.2 (#4308) @scalameta-bot
- Update mdoc, sbt-mdoc to 2.6.1 (#4307) @scalameta-bot
- Update scalacheck to 1.18.1 (#4306) @scalameta-bot
- Update scala-library, scala-reflect to 2.12.20 (#4304) @scalameta-bot
- Update contributing-scalafmt.md (#4184) @charpov
- Update sbt-native-packager to 1.10.4 (#4179) @scalameta-bot
- Update sbt-ci-release to 1.6.1 (#4178) @scalameta-bot
- Update sbt-mima-plugin to 1.1.4 (#4180) @scalameta-bot
- Update munit to 1.0.1 (#4181) @scalameta-bot
- Update metaconfig-core, ... to 0.13.0 (#4177) @scalameta-bot
Bug fixes and supporting changes addressing bugs in formatting public code
- Router: fix handling of comment-space-dot chain (#4435) @kitbellew
- Split: make killOnFail an Option, set a default (#4428) @kitbellew
- FormatOps: simplify logic of defnSiteLastToken (#4427) @kitbellew
- State: don't penalize punct overflow (#4426) @kitbellew
- Router: don't penalize NL before
:
if keeping (#4425) @kitbellew - Router: remove optimal if avoid interpolation NL (#4423) @kitbellew
- State: delay penalty if
avoid
in interpolation (#4424) @kitbellew - BestFirstSearch: remove a useless optimization (#4421) @kitbellew
- FormatOps: extend SlbEnd to lbrace, colon, comment (#4422) @kitbellew
- Router: change lambda space splits (#4420) @kitbellew
- Router: move up check for no NL after
<-
enums (#4419) @kitbellew - ConvertToNewScala3Syntax: remove
:_
/@_
as unit (#4417) @kitbellew - Router: add dedicated rule for formatOff (#4411) @kitbellew
- FormatWriter: fix rare but possible bug (#4410) @kitbellew
- Router: fix performance of chained apply calls, with anon functions (#4409) @kitbellew
- OptimizationEntities: move TreeOps.statementStarts (#4408) @kitbellew
- FormatOps: fix ForYield as CtrlBody (#4406) @kitbellew
- Router: require NL before
}
if non-SLB({
(#4405) @kitbellew - TreeOps: inline getEnumStatements (#4404) @kitbellew
- FormatTokens: move distance from FormatOps (#4403) @kitbellew
- FormatTests: assert on the total number of visits (#4402) @kitbellew
- TreeOps: inline extractStatementsIfAny (#4397) @kitbellew
- Router: extend SLB optimal for
(...
(#4400) @kitbellew - FormatOps: SelectLike uses FormatToken as
name
(#4399) @kitbellew - FormatOps: extract helpers to OptimizationEntities (#4398) @kitbellew
- Literals: move Case inside the companion (#4396) @kitbellew
- FormatTokens: return FormatToken in matchingXxx (#4395) @kitbellew
- FormatTokens: define a few more methods (#4394) @kitbellew
- HasTests: parse and assert expected state visits (#4392) @kitbellew
- Router: increase penalty for NL before colon (#4389) @kitbellew
- RedundantBraces: keep if a comment is attached (#4384) @kitbellew
- RedundantParens: keep w/ dotless select in infix (#4386) @kitbellew
- FormatOps: ignore removed block in select chains (#4387) @kitbellew
- ScalafmtConfig: add
withFileOverride()
(#4383) @kitbellew - FormatOps: ignore source NL in binpacking ctors (#4379) @kitbellew
- FormatOps: use optimal slb end in binpacked
(...
(#4381) @kitbellew - BestFirstSearch: stop using State.allAltAreNL (#4369) @kitbellew
- TreeOps: also ignore single-stat rewritten blocks (#4377) @kitbellew
- TreeOps: ignore single block stat for NL optimizn (#4375) @kitbellew
- RedundantBraces: keep some around PartialFunction (#4374) @kitbellew
- TreeOps: revise NL-optimization around functions (#4372) @kitbellew
- Router: price sole NL split in
=> <NL>
at 1 (#4371) @kitbellew - FormatOps: no blank within infix if not enclosed (#4370) @kitbellew
- TreeOps: skip 1st stat in case body in NL optimizn (#4367) @kitbellew
- Router: price sole NL split in
=> comment
at 1 (#4366) @kitbellew - Router: no
startsStatement
for{
(#4365) @kitbellew - BestFirstSearch: call StateQueue.enqueue directly (#4362) @kitbellew
- Router: no
startsStatement
for=>
(#4364) @kitbellew - Router: consolidate splits around lambda (#4363) @kitbellew
- Router: check if "NL" for
(
is actually not NL (#4359) @kitbellew - TreeOps: get owners via token range, not position (#4357) @kitbellew
- RedundantBraces: keep around do-while within for (#4356) @kitbellew
- BestFirstSearch: arg clause an opt-zone for keep (#4354) @kitbellew
- Router: fix consistency based on src NL existence (#4355) @kitbellew
- FormatOps: extend slb end past select for
keep
(#4353) @kitbellew - Route: hide NL before dot for keep via a splittag (#4351) @kitbellew
- RemoveScala3OptionalBraces: not with no-NL select (#4352) @kitbellew
- Router: extract single stat from rewritten block (#4349) @kitbellew
- RedundantBraces:
else-if
always ok if opt-braces (#4339) @kitbellew - BestFirstSearch: optimal has low-penalty NL split (#4338) @kitbellew
- Router: bp=defnsite
(
use first comma as optimal (#4337) @kitbellew - BestFirstSearch: updateBest both states (#4336) @kitbellew
- Split: separate original cost and later penalty (#4335) @kitbellew
- FormatOps: add first param to arguments with mod (#4334) @kitbellew
- RedundantBraces: can't remove after semicolon (#4333) @kitbellew
- FormatOps: consider scalajs tucking in getSlbEnd (#4332) @kitbellew
- FormatOps: remove narrowing of scalaJsStyle flag (#4331) @kitbellew
- FormatOps: generic getBinPackSiteFlags overload (#4330) @kitbellew
- BestFirstSearch: recurse within parens as well (#4329) @kitbellew
- FormatOps: in CtrlBody, use optimal in arg clause (#4328) @kitbellew
- ScalafmtRunner: turn maxVisits into Option[Int] (#4327) @kitbellew
- BestFirstSearch: slightly refactor
explode()
(#4326) @kitbellew - FormatOps: extend optimal token past left bracket + Type.Select is also SelectLike (#4317) @kitbellew
- Router: merge rhsOptimalToken+endOfSingleLineBlock (#4319) @kitbellew
- HasTests: run tests without slow states (#4316) @kitbellew
- Router: kill on fail for select as infix rhs (#4315) @kitbellew
- BestFirstSearch: shortestPath return failing state (#4314) @kitbellew
- Router: skip braces when looking for binpack comma (#4312) @kitbellew
- Router: extend SLB after scala.js right paren (#4311) @kitbellew
- BestFirstSearch: state w/ SLB policy isn't
best
(#4310) @kitbellew - BestFirstSearch: extract stats into separate class (#4302) @kitbellew
- Policy: allow checking if a sub-policy exists (#4303) @kitbellew
- BestFirstSearch: opt shortcut to compare positions (#4301) @kitbellew
- BestFirstSearch: define getNext() (#4300) @kitbellew
- BestFirstSearch: extract processing optimal token (#4299) @kitbellew
- Policy: check if policy will apply to future token (#4297) @kitbellew
- ScalafmtOptimizer: allow to do only no-slow-states (#4296) @kitbellew
- BestFirstSearch: extract queues into a new class (#4295) @kitbellew
- BestFirstSearch: remove unused traverseZeroCost (#4292) @kitbellew
- BestFirstSearch: fix bug, possible infinite loop (#4293) @kitbellew
- FormatOps: slightly refactor scala.js policy (#4291) @kitbellew
- BestFirstSearch: extract check for SLB policy (#4290) @kitbellew
- BestFirstSearch: don't import optimizer wildcard (#4287) @kitbellew
- TreeOps: statements don't start on a comment (#4286) @kitbellew
- RedundantBraces: keep unrelated thenp/elsep apart (#4285) @kitbellew
- RedundantBraces: keep between
return
and comment (#4284) @kitbellew - Fix redundant braces around infix (top-level, and using
return
) (#4278) @kitbellew - RedundantBraces: keep if they separate xml tokens (#4277) @kitbellew
- RedundantBraces: keep braces around Term.Xml (#4276) @kitbellew
- Router: keep NL policy before
if
guard ifkeep
(#4275) @kitbellew - FormatOps: remove redundant check for LeftParen (#4274) @kitbellew
- Router: fix enclosed case body w/ paren after NL (#4265) @kitbellew
- FormatOps: in CtrlBody, be consistent about src NL (#4264) @kitbellew
- FormatOps: no NL before infix op unless dialect OK (#4263) @kitbellew
- RedundantBraces: keep block w/ standalone comment (#4262) @kitbellew
- FormatOps: a "top-level" block is one with braces (#4260) @kitbellew
- RedundantParens: keep around select without dot (#4261) @kitbellew
- Check dialect to rewrite infix as part of
try
(#4259) @kitbellew - Router: add optimal token in pattern alternatives (#4258) @kitbellew
- FormatWriter: don't wrap malformed scaladoc (#4257) @kitbellew
- FormatOps: fix extension formatting (#4255) @kitbellew
- FormatOps: if excluding opt-braces, skip comments (#4253) @kitbellew
- Router:
recurseOnly
incase if
when excluding (#4252) @kitbellew - Router: preserve blank after extension (#4251) @kitbellew
- Router: add missing single-line policy for .select (#4250) @kitbellew
- Router: killOnFail in last binpack arg/parameter (#4249) @kitbellew
- Router: do not penalize breaks in closing parens (#4248) @kitbellew
- Router: tune optimal/killOnFail in binpack parens (#4247) @kitbellew
- Router: recurse only SLB in ctrl body for
keep
(#4246) @kitbellew - BestFirstSearch: kill opt if failed single-line (#4245) @kitbellew
- OptimalToken: add flag not to exclude other splits (#4244) @kitbellew
- BestFirstSearch: also traverse past 0-cost parens (#4243) @kitbellew
- BestFirstSearch: properly use optimal/killOnFail (#4242) @kitbellew
- FormatOps: check left paren in startsBlockOnRight (#4241) @kitbellew
- BestFirstSearch: extract state logic (#4240) @kitbellew
- FormatOps: don't force break before right paren (#4235) @kitbellew
- FormatOps: use isInfixRhs in startsNewBlockOnRight (#4239) @kitbellew
- State: add lineId and use it in state ordering (#4238) @kitbellew
- Add tests with break/paren/comment (#4237) @kitbellew
- BestFirstSearch: only update
best
at the end (#4236) @kitbellew - Router: preserving close break if source=keep (#4234) @kitbellew
- FormatOps: refactor endOfSingleLineBlock (#4233) @kitbellew
- DanglingParentheses: method to combine call/defn (#4232) @kitbellew
- BestFirstSearch: cosmetic, change import level (#4231) @kitbellew
- Newlines: define shortcuts for source kind (#4230) @kitbellew
- TokenClasses: add matches/apply, to join unapply (#4226) @kitbellew
- FormatOps: move
isJustBeforeTree
to FormatTokens (#4229) @kitbellew - FormatOps: get ClauseSiteFlags fields implicitly (#4228) @kitbellew
- BestFirstSearch: invert {always -> possibly}Better (#4227) @kitbellew
- Add tests with binpack/keep/
.select
(#4225) @kitbellew - FormatOps: pass current format token as implicit (#4222) @kitbellew
- Router: skip optimal in apply parens for
keep
(#4214) @kitbellew - Add more regression and also non-idempotent tests (#4213) @kitbellew
- Router: keep
then
NL cost at 1 even if no space (#4212) @kitbellew - Router: modify select-like detection for comments (#4211) @kitbellew
- FormatOps: verify that for-yield body is in braces (#4210) @kitbellew
- TreeOps: refactor SingleArgInBraces common logic (#4209) @kitbellew
- FormatOps: adjust ctrl body expiration, NL forcing (#4206) @kitbellew
- FormatOps: opt-braces
catch
uses newlines.source (#4205) @kitbellew - Router: ignore end marker for open paren indent (#4204) @kitbellew
- Test nested catch within match, trailing comments, docstrings etc. (#4203) @kitbellew
- FormatOps: dedicated opt-braces rule for
with
(#4202) @kitbellew - BestFirstSearch: recurse right after opening brace (#4201) @kitbellew
- FormatWriter: slightly refactor setting blanks (#4200) @kitbellew
- Router: refactor control-blocks single-line policy (#4199) @kitbellew
- FormatOps: don't use unapply on various trees (#4198) @kitbellew
- FormatWriter: consolidate multiple align cases (#4197) @kitbellew
- Router: remove redundant check (#4196) @kitbellew
- Router: refactor template formatting slightly (#4195) @kitbellew
- Router: no spaces.inParentheses if redundant paren (#4194) @kitbellew
- FormatToken: add a few proxy methods (#4193) @kitbellew
- BestFirstSearch: refactor recursing on blocks (#4192) @kitbellew
- FormatWriter: move
indentedPackage
to FormatOps (#4191) @kitbellew - Router: expand defn of multi-line top-level stat (#4190) @kitbellew
- FormatWriter: don't break before non-text scaladoc (#4186) @kitbellew
- FormatOps: force break after semicolon in CtrlBody (#4174) @kitbellew
- Router: adjust indent on open paren for end marker (#4171) @kitbellew
- FormatWriter: align on actual splits, not original (#4173) @kitbellew
- Router: preserve blank lines around control body (#4172) @kitbellew
- FormatOps/RemoveScala3OptionalBraces: remove nested blocks (#4170) @kitbellew
- TreeOps: implement
getTreeSingleExpr
(#4169) @kitbellew - TreeOps: check single element for multi-value tree (#4168) @kitbellew
- FormatOps: refactor opt-braces rules with stats (#4167) @kitbellew
- FormatOps: check optional braces NL before comment (#4164) @kitbellew
- FormatOps: define OptionalBraces.isJustBeforeXxx (#4163) @kitbellew
- FormatOps: find optional braces in nested blocks (#4160) @kitbellew
- FormatOps: definite NL in OptionalBraces.BlockImpl (#4162) @kitbellew
- FormatTokens: move
getBraces
from TreeOps (#4161) @kitbellew - Router: use optimal token for brace-ending chains (#4159) @kitbellew
- Router: define chain splits as dedicated variables (#4158) @kitbellew
- Router: align costs to ignore current break (#4157) @kitbellew
- FormatOps: don't break within comment in ctrl body (#4149) @kitbellew
- FormatWriter: insert end marker after semicolon (#4155) @kitbellew
- Router: no space around
{
to be changed to(
(#4153) @kitbellew - FormatTokens: get last skipping attached comments (#4154) @kitbellew
- FormatWriter: modify brace-to-paren rewrite steps (#4152) @kitbellew
- FormatWriter: move parens rewrite checks elsewhere (#4151) @kitbellew
- Split: expose
mod
viamodExt
in Split/State (#4150) @kitbellew - Router: combine two
case
splits via policies (#4141) @kitbellew - Router: disambiguate end marker in keyword rules (#4140) @kitbellew
- RedundantBraces: don't remove empty blocks (#4148) @kitbellew
- TreeOps: handle removed braces with nested lambdas (#4144) @kitbellew
- FormatOps: Ctrl body can be tuple in removed block (#4145) @kitbellew
- RedundantBraces: don't remove if annotated (#4143) @kitbellew
- FormatOps: fix cond between
while
anddo
(#4139) @kitbellew - Router: extend optimal token to include comment (#4138) @kitbellew
- Router: apply src=keep around
: return-type
(#4137) @kitbellew - Router: no space after
=>
if empty body (#4136) @kitbellew - FormatOps: optional braces if ends in lone comment (#4134) @kitbellew
- Error: add reason to
SearchStateExploded
(#4135) @kitbellew - Imports: improve blank line detection (#4132) @kitbellew
- Router: fix extensions with/out optional braces (#4131) @kitbellew
- RemoveScala3OptionalBraces: rewrite
else
ifif
is converted (#4130) @kitbellew - Router: fix
annotationNewlines=false
(#4128) @kitbellew - FormatTokens: add line/column for missing tokens (#4129) @kitbellew
- Router: move up rule for def/val
=
(#4127) @kitbellew - FormatWriter: don't insert braces if optional (#4126) @kitbellew
- FormatTokensRewrite: fix MultiNL copy bug (#4125) @kitbellew
- FormatOps: refactor OptionalBraces (#4123) @kitbellew
- Use Tree.With{Stats,Enums,Cases} (#4121) @kitbellew