justinhj / battery.nvim

Neovim plugin to detect and view battery information
MIT License
59 stars 9 forks source link

bug? (not really): inconsistent practices #34

Closed Agent-E11 closed 3 months ago

Agent-E11 commented 3 months ago

I have noticed that there are some inconsistencies in the style of code.

Modules: Returning a table with key-value pairs for functions: example A module table M (with key-value pairs set at the end): example A module table M (with key-value pairs set at value declarations): example

Strings: Double quoted strings: example (whole file) Single quoted strings: example

(There might be a couple other things)

My suggestions would be:

Module table M with key-value pairs set at value declaration:

local M = {}
function M.my_func() -- I prefer this to `M.my_func = function() ... end`, but I don't mind the second one that much
  ...
end
return M

And double quoted strings (though, I care much less about this one, I just care that they are all the same)

This might be a slight OCD issue 😅, but I think it would be nice to have some more consistent practices.

justinhj commented 3 months ago

I'm a fan of consistency. I was learning lua as I made the plugin so the style is a bit all over the place as you noticed. I do use luacheck in the commit checks so will gradually clean things up and add checks as time goes on.

justinhj commented 3 months ago

Have addressed in #36 It's a lot of minor changes but will merge once I've tested it a bit. Feel free to give the branch a try. stylua is the branch name.