perform some statix linting and fixes

This commit is contained in:
Tanish2002 2023-05-22 15:45:47 +05:30 committed by Gaétan Lepage
parent eee375e97e
commit efdcbe225f
57 changed files with 196 additions and 221 deletions

View file

@ -30,7 +30,7 @@ in {
default = null;
};
toggler = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule (_: {
options = {
line = mkOption {
type = types.str;
@ -48,7 +48,7 @@ in {
default = null;
};
opleader = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule (_: {
options = {
line = mkOption {
type = types.str;
@ -66,7 +66,7 @@ in {
default = null;
};
mappings = mkOption {
type = types.nullOr (types.submodule ({...}: {
type = types.nullOr (types.submodule (_: {
options = {
basic = mkOption {
type = types.bool;
@ -93,12 +93,7 @@ in {
config = let
setupOptions = {
padding = cfg.padding;
sticky = cfg.sticky;
ignore = cfg.ignore;
toggler = cfg.toggler;
opleader = cfg.opleader;
mappings = cfg.mappings;
inherit (cfg) padding sticky ignore toggler opleader mappings;
};
in
mkIf cfg.enable {

View file

@ -127,7 +127,7 @@ in {
session_directory = cfg.sessionDirectory;
};
filteredOptions = filterAttrs (_: v: !isNull v) options;
filteredOptions = filterAttrs (_: v: v != null) options;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];

View file

@ -54,11 +54,11 @@ in {
};
'';
navNext = helpers.mkNullOrOption (types.str) ''
navNext = helpers.mkNullOrOption types.str ''
Keymap for navigating to next mark.";
'';
navPrev = helpers.mkNullOrOption (types.str) ''
navPrev = helpers.mkNullOrOption types.str ''
Keymap for navigating to previous mark.";
'';
@ -171,11 +171,10 @@ in {
mark_branch = cfg.markBranch;
};
projects = projects;
inherit projects;
menu = {
width = cfg.menu.width;
height = cfg.menu.height;
inherit (cfg.menu) width height;
borderchars = cfg.menu.borderChars;
};
}
@ -197,13 +196,14 @@ in {
(
optionName: luaFunc: let
key = km.${optionName};
in (mkIf (key != null) {
${key} = {
action = luaFunc;
lua = true;
inherit silent;
};
})
in
mkIf (key != null) {
${key} = {
action = luaFunc;
lua = true;
inherit silent;
};
}
)
{
addFile = "require('harpoon.mark').add_file";

View file

@ -118,14 +118,14 @@ in
lazy_loading = cfg.lazyLoading;
logger = {
plugin = cfg.logger.plugin;
inherit (cfg.logger) plugin;
use_console = cfg.logger.useConsole;
highlights = cfg.logger.highlights;
inherit (cfg.logger) highlights;
use_file = cfg.logger.useFile;
level = cfg.logger.level;
inherit (cfg.logger) level;
modes =
if (isNull cfg.logger.modes)
if (cfg.logger.modes == null)
then null
else
attrsets.mapAttrsToList
@ -133,7 +133,7 @@ in
name = mode;
inherit (modeConfig) hl;
level = let
level = modeConfig.level;
inherit (modeConfig) level;
in
if (isInt level)
then level

View file

@ -54,8 +54,7 @@ in {
config = let
setupOptions = with cfg; {
stages = stages;
timeout = timeout;
inherit stages timeout;
background_colour = backgroundColour;
minimum_width = minimumWidth;
icons = with icons; {

View file

@ -101,7 +101,7 @@ in {
mkIf cfg.enable {
extraPlugins = [cfg.package];
plugins.treesitter.enable = mkIf (cfg.checkTs == true) true;
plugins.treesitter.enable = mkIf (cfg.checkTs != null && cfg.checkTs) true;
extraConfigLua = ''
require('nvim-autopairs').setup(${helpers.toLuaObject options})

View file

@ -136,7 +136,7 @@ in {
inherit wrap;
buf_label = bufLabel;
should_preview_cb =
if isNull shouldPreviewCb
if (shouldPreviewCb == null)
then null
else helpers.mkRaw shouldPreviewCb;
};

View file

@ -61,19 +61,19 @@ in
action = "require('osc52').copy_operator";
expr = true;
lua = true;
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
};
"${cfg.keymaps.copyLine}" = {
action = "${cfg.keymaps.copy}_";
remap = true;
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
};
};
visual = {
"${cfg.keymaps.copyVisual}" = {
action = "require('osc52').copy_visual";
lua = true;
silent = cfg.keymaps.silent;
inherit (cfg.keymaps) silent;
};
};
};

View file

@ -161,10 +161,10 @@ in {
log_level = cfg.logLevel;
debounce_timeout = cfg.debounceTimeout;
enable_line_number = cfg.enableLineNumber;
blacklist = cfg.blacklist;
inherit (cfg) blacklist;
file_assets = cfg.fileAssets;
show_time = cfg.showTime;
buttons = cfg.buttons;
inherit (cfg) buttons;
# Rich presence text options.
editing_text = cfg.editingText;

View file

@ -66,7 +66,7 @@ in {
{
manual_mode = cfg.manualMode;
detection_methods = cfg.detectionMethods;
patterns = cfg.patterns;
inherit (cfg) patterns;
ignore_lsp = cfg.ignoreLsp;
exclude_dirs = cfg.excludeDirs;
show_hidden = cfg.showHidden;

View file

@ -129,7 +129,7 @@ in {
popup = {
inherit (cfg) blend width;
winhl =
if (!isNull cfg.color)
if (cfg.color != null)
then "SpecsPopColor"
else "PMenu";
delay_ms = cfg.delay;
@ -150,7 +150,7 @@ in {
mkIf cfg.enable {
extraPlugins = [cfg.package];
highlight.SpecsPopColor.bg = mkIf (!isNull cfg.color) cfg.color;
highlight.SpecsPopColor.bg = mkIf (cfg.color != null) cfg.color;
extraConfigLua = ''
require('specs').setup(${setup})

View file

@ -222,9 +222,9 @@ in {
config = let
setupOptions =
{
signs = cfg.signs;
inherit (cfg) signs;
sign_priority = cfg.signPriority;
keywords = cfg.keywords;
inherit (cfg) keywords;
gui_style = cfg.guiStyle;
merge_keywords = cfg.mergeKeywords;
highlight = helpers.ifNonNull' cfg.highlight {
@ -244,14 +244,14 @@ in {
comments_only = cfg.highlight.commentsOnly;
max_line_len = cfg.highlight.maxLineLen;
};
colors = cfg.colors;
inherit (cfg) colors;
search = helpers.ifNonNull' cfg.search {
inherit (cfg.search) command args;
pattern =
helpers.ifNonNull' cfg.search.pattern
(
if isList cfg.search.pattern
then (map (p: helpers.mkRaw p) cfg.search.pattern)
then (map helpers.mkRaw cfg.search.pattern)
else helpers.mkRaw "[[${cfg.search.pattern}]]"
);
};
@ -266,7 +266,7 @@ in {
maps.normal = let
silent = cfg.keymapsSilent;
keymaps = cfg.keymaps;
inherit (cfg) keymaps;
in
mkMerge (
mapAttrsToList
@ -274,25 +274,26 @@ in {
optionName: funcName: let
keymap = keymaps.${optionName};
key = keymap.key;
inherit (keymap) key;
cwd = optionalString (!isNull keymap.cwd) " cwd=${keymap.cwd}";
keywords = optionalString (!isNull keymap.keywords) " keywords=${keymap.keywords}";
cwd = optionalString (keymap.cwd != null) " cwd=${keymap.cwd}";
keywords = optionalString (keymap.keywords != null) " keywords=${keymap.keywords}";
action = ":${funcName}${cwd}${keywords}<CR>";
in (mkIf (keymap != null) {
${key} = {
inherit silent action;
};
})
in
mkIf (keymap != null) {
${key} = {
inherit silent action;
};
}
)
commands
);
# Automatically enable plugins if keymaps have been set
plugins = mkMerge [
(mkIf (!isNull cfg.keymaps.todoTrouble) {trouble.enable = true;})
(mkIf (!isNull cfg.keymaps.todoTelescope) {telescope.enable = true;})
(mkIf (cfg.keymaps.todoTrouble != null) {trouble.enable = true;})
(mkIf (cfg.keymaps.todoTelescope != null) {telescope.enable = true;})
];
};
}

View file

@ -34,14 +34,14 @@ in {
extraPlugins = [cfg.package];
maps.normal = with cfg.keymaps;
(optionalAttrs (!isNull bdelete)
(optionalAttrs (bdelete != null)
{
${bdelete} = {
action = ":Bdelete<CR>";
silent = cfg.keymapsSilent;
};
})
// (optionalAttrs (!isNull bwipeout)
// (optionalAttrs (bwipeout != null)
{
${bwipeout} = {
action = ":Bwipeout<CR>";