You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Memorize which files were not changed since last styling #320
Could significantly speedup style_file() and style_dir() when used often as well as pre-commit hooks. Needs new infrastructure .styler folder in root directory.
@krlmlr I think this is worth exploring, it goes into the same direction as parallelization. There are quite a few design questions involved with this, so I'd like to hear your opinion on this. Should we use a .styler file? Or store the hashes of the files in a config.styler file, along with some configs?
Also, let's compare our ideas with other source code formatters: black uses a non-portable file stored in some cache, the path to which is system dependent: psf/black#136.
Storing hashed data in the root may also convolute too many directories. Also, note that depending on how this is implemented, the complexity should not be underestimated. For example, caching is invalidated if the styler version changes or if the (hashed) contents to be styled change (alternatively: last modification time with styler is also last overall modification time).
We can use the R.cache package to make sure we cache things in the right location OS-independently. Then follow: psf/black#109 (comment). We can store version of styler as well as the hash of the file content (requires reading them, as opposed to use file size and modification time), then.
read file and hash contents.
check if hash is already in cache (including error handling when cache can't be read properly). Potentially using the R package storr for this.
if it is, skip that file.
if it is not, style and add the hash to the data base.
Activity
lorenzwalthert commentedon Sep 23, 2018
@krlmlr I think this is worth exploring, it goes into the same direction as parallelization. There are quite a few design questions involved with this, so I'd like to hear your opinion on this. Should we use a
.stylerfile? Or store the hashes of the files in aconfig.stylerfile, along with some configs?krlmlr commentedon Sep 24, 2018
A directory or a separate file would be better, we don't want to mix config data and hash data.
lorenzwalthert commentedon Apr 13, 2019
Also, let's compare our ideas with other source code formatters: black uses a non-portable file stored in some cache, the path to which is system dependent: psf/black#136.
Storing hashed data in the root may also convolute too many directories. Also, note that depending on how this is implemented, the complexity should not be underestimated. For example, caching is invalidated if the styler version changes or if the (hashed) contents to be styled change (alternatively: last modification time with styler is also last overall modification time).
lorenzwalthert commentedon Aug 13, 2019
We can use the R.cache package to make sure we cache things in the right location OS-independently. Then follow: psf/black#109 (comment). We can store version of styler as well as the hash of the file content (requires reading them, as opposed to use file size and modification time), then.
Benefits of this approach are (credits to psf/black#109 (comment)):