Skip to content

A personal list of issues in formatting / stuff ive noticed #4

Description

@Squawkykaka

Im looking at formatter rules, and im comparing against alejandra here, and i might make a fork of alejandra for these changes. I basically formatted the fish file and compared against them, the reason im looking at alejandra is that it doesnt have half an hour compile times and isnt written in haskell

some ones ive noticed:

  • in an if option ? thing then statement, then shouldnt get a new line.
  • an attrset / list should always have a space around it { thing = "test"; } rather than {thing = "test";}
  • lists with long elements should be appended with newlines e.g.
if option ? something then
  [
      (abbrToString abbr expansion false command)
  ]
else
  # should this have or not have a space?
  [ ]; # <- should semicolon be pushed to a new line?

# instead of
if option ? something then [
  (abbrToString abbr expansion false command)
]
else if option ? thing2 then [
  (specialthing2)
]
else
 [];

# should the final else have a newline when its really short?
# currently this
else
 [];

# but should we have this?
else [];

some ones im not sure on

  • the impl, and mergefunc, should they have a newline after each function input?
  • should let block functions have a newline before args?
    e.g
abbrToString =
  abbr: expansion: setCursor: command:

# instead of
abbrToString = abbr: expansion: setCursor: command:
  • should a function that unwrapps an attrset do
# 1
mergeFunc = {
  mutators,
  options,
}: let

# 2
mergeFunc = {
  mutators,
  options,
}:
let

# 3 / 4
mergeFunc = { mutators, options }: 
let

## no newline
mergeFunc = { mutators, options }: let

# or keep what we currently have?
mergeFunc = 
  { mutators, options }: 
  let
  • should a () scope in an attrrset have a newline? e.g.
symlinks =
  (
    # stuff
  )

# rather than
symlinks = (
    # stuff
)

# this also ties in to `//`
# should 
symlinks = (
  # stuff
) // ( # notice the lack of a newline
  # more stuff
)

# instead of this (what we have currently)
symlinks = (
  # stuff
) 
// (
  # more stuff
)
  • should passing in a value to a function begin on newline?
# current
listToAttrs (
  map (path: {
    name = "$out/share/fish/vendor_functions.d/${baseNameOf path}";
    value = path;
}) options.functionsFiles

# what alejandra does
listToAttrs (
  map (path: {
    name = "$out/share/fish/vendor_functions.d/${baseNameOf path}";
    value = path;
})
options.functionsFiles

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions