Skip to content

Commit

Permalink
Review in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Gant committed Aug 3, 2021
1 parent 3da5c0f commit 5098583
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ If you've created a config file, you have to configure its path in the plugin's
}
```

When using multiple projects with different configurations, it's possible to configure the path relative to the Sublime project folder:
When using multiple projects with different configurations, it's possible to
configure the path relative to the Sublime project folder:

```js
{
Expand All @@ -63,11 +64,16 @@ It's also possible to specify multiple config paths. In that case, the first rea
}
```

See [`extract_variables` in the Sublime API Reference](https://www.sublimetext.com/docs/3/api_reference.html#sublime.Window) for the supported replacement variables. The value of the `${folder}` points the path of the first project in Sublime API. Here, it's beforehand replaced with the path of the project the target file belongs.
See [`extract_variables` in the Sublime API Reference](https://www.sublimetext.com/docs/3/api_reference.html#sublime.Window)
for the supported replacement variables. The value of the `${folder}` points
the path of the first project in Sublime API. Here, it's beforehand replaced
with the path of the project the target file belongs.

Please note that this plugin don't try to find the config file automatically. If you want to create a config file, you have to specify its path in the plugin settings.
Please note:

Although you can configure the rules directly on your plugin settings, it's recommended to create the config file, as it's easier to configure every rule than using the 'rules' directive in the plugin settings.
* **`rules` and `config` directives are excluding.**
* This plugin don't try to find the config file automatically. If you want to
create a config file, you have to specify its path in the plugin settings.

## Rules

Expand All @@ -85,6 +91,8 @@ Although you can configure the rules directly on your plugin settings, it's reco
}
```

*Please note that `rules` and `config` directives are excluding.*

For more information see: https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage

## Exclude files
Expand Down
11 changes: 9 additions & 2 deletions SublimePhpCsFixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,19 @@ def run(self, tmp_file):
self.logger.console("Error output: {0}".format(err))

def create_cmd(self, tmp_file):
config = self.config_param()
rules = self.rules_param()

if rules and config:
self.logger.console("rules and config are both present, rules prevails")
config = None

return list(filter(None, [
self.settings.get_expanded('php_path'),
self.get_configured_php_cs_fixer_path(),
"fix",
self.config_param(),
self.rules_param(),
rules,
config,
"--using-cache=no",
tmp_file,
]))
Expand Down

0 comments on commit 5098583

Please sign in to comment.