Skip to content

Commit df93c72

Browse files
committed
handle non-writable case
1 parent be7c0d3 commit df93c72

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/refactor.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ function globalrefactor(old, new, mod, expr)
107107
end
108108
files = modulefiles(entrypath)
109109

110+
nonwritablefiles = filter(f -> Int(Base.uperm(f)) 6, files)
111+
if !isempty(nonwritablefiles)
112+
return :warning, nonwritabledescription(mod, nonwritablefiles)
113+
end
114+
110115
with_logger(JunoProgressLogger()) do
111116
refactorfiles(old, new, mod, files, expr)
112117
end
@@ -176,6 +181,18 @@ function contextdescription(old, mod, context)
176181
"""
177182
end
178183

184+
function nonwritabledescription(mod, files)
185+
filelist = join(("<li>[$file]($(uriopen(file)))</li>" for file in files), '\n')
186+
"""
187+
Global rename refactor failed, since there are non-writable files detected in
188+
`$mod` module.
189+
190+
<details><summary>
191+
Non writable files (all in `$mod` module):
192+
</summary><ul>$(filelist)</ul></details>
193+
"""
194+
end
195+
179196
function filedescription(mod, files)
180197
filelist = join(("<li>[$file]($(uriopen(file)))</li>" for file in files), '\n')
181198
"""

0 commit comments

Comments
 (0)