Skip to content

Commit 31b1e98

Browse files
committed
🐛 Fix #2: incorrect empty check always returns early
1 parent 02106d4 commit 31b1e98

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v5.0.0
4+
rev: v6.0.0
55
hooks:
66
- id: check-added-large-files
77
- id: fix-byte-order-marker
@@ -37,15 +37,15 @@ repos:
3737
args:
3838
- --msg-filename
3939
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
40-
rev: 3.2.1
40+
rev: 3.4.0
4141
hooks:
4242
- id: editorconfig-checker
4343
- repo: https://github.com/jumanjihouse/pre-commit-hooks
4444
rev: 3.0.0
4545
hooks:
4646
- id: check-mailmap
4747
- repo: https://github.com/rhysd/actionlint
48-
rev: v1.7.7
48+
rev: v1.7.8
4949
hooks:
5050
- id: actionlint
5151
- repo: https://github.com/adrienverge/yamllint

lua/code-stats.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--- functions for codestats
2+
local dotenv = require "lua-dotenv"
23
local requests = require "requests"
34
local cjson = require "cjson"
45

@@ -698,7 +699,6 @@ local M = {
698699
function M.setup(conf)
699700
M = vim.tbl_deep_extend("keep", conf, M)
700701
if conf.dotenv then
701-
local dotenv = require "lua-dotenv"
702702
dotenv.load_dotenv(conf.dotenv)
703703
M.args.headers['X-API-Token'] = dotenv.get('CODESTATS_API_KEY')
704704
end
@@ -715,7 +715,11 @@ end
715715
---send xp
716716
---@return table
717717
function M.send_xp()
718-
if #M.xps == 0 then
718+
local xp = 0
719+
for _, v in pairs(M.xps) do
720+
xp = xp + v
721+
end
722+
if xp == 0 then
719723
return {}
720724
end
721725
local xps = M.xps

0 commit comments

Comments
 (0)