ypresto / SwiftLintXcode

An Xcode plug-in to format your code using SwiftLint.
Other
351 stars 15 forks source link

swiftlint at (B/usr/local/bin/swiftlint is not executable. #7

Closed jlaws closed 8 years ago

ypresto commented 8 years ago

This plugin runs bash -c 'which swiftlint' internally. Can you run it manually and tell me what is shown?

jlaws commented 8 years ago

/usr/local/bin/swiftlint

jlaws commented 8 years ago

Running OX X El Capitan 10.11.4 and Xcode 7.3 (7D175)

huguesbr commented 8 years ago

:+1: same issue

OX X El Capitan 10.11.4 and Xcode 7.3 (7D175)

$ bash -lc 'which swiftlint'
/usr/local/bin/swiftlint
$ ls -l /usr/local/bin/swiftlint
lrwxr-xr-x  1 hugues  admin  39 Mar 20 20:40 /usr/local/bin/swiftlint -> ../Cellar/swiftlint/0.6.0/bin/swiftlint
$ /usr/local/bin/swiftlint
Linting Swift files in current working directory

At the look of the error, it seem some trimming is missing:

maybe around here? https://github.com/ypresto/SwiftLintXcode/blob/master/SwiftLintXcode/Formatter.swift#L113

ypresto commented 8 years ago

Prepended sequence is:

   1b
(   28
B   42
   1b
[   5b
m   6d

It looks like ANSI escape sequence used by supported terminal emulators. Do you set TERM env var in your .bashrc?

jlaws commented 8 years ago

declare -x TERM="xterm-256color"

On Fri, Apr 15, 2016 at 7:15 AM, Yuya Tanaka notifications@github.com wrote:

Prepended sequence is:

� 1b ( 28 B 42 � 1b [ 5b m 6d

It looks like ANSI escape sequence used by supported terminal emulators. Do you set TERM env var in your .bashrc?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/ypresto/SwiftLintXcode/issues/7#issuecomment-210460643

ypresto commented 8 years ago

Sorry but, I couldn't reproduce with above declaration. Can you try this branch? https://github.com/ypresto/SwiftLintXcode/tree/norc

Only difference is:

-            "-l", "-c", "which \(name)"
+            "--norc", "-l", "-c", "which \(name)"

Also, can you provide full .bashrc as gist? There may be common declaration in bashrc for whom reproducing this.

huguesbr commented 8 years ago

@ypresto nop... just try same issue...

huguesbr commented 8 years ago

my .bashrc is pretty crazy as I have tons of custom (using dotfiles...)

.bashrc

[ -n "$PS1" ] && source ~/.bash_profile;
[ -f ~/.bundler-exec.sh ] && source ~/.bundler-exec.sh

bash_profile

# Add `~/bin` to the `$PATH`
export PATH="$HOME/bin:$PATH";

# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you don’t want to commit.
for file in ~/.{path,bash_prompt,exports,aliases,functions,extra}; do
    [ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;

# https://github.com/rupa/z
. ~/.z.sh

# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob;

# Append to the Bash history file, rather than overwriting it
shopt -s histappend;

# Autocorrect typos in path names when using `cd`
shopt -s cdspell;

# Enable some Bash 4 features when possible:
# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
# * Recursive globbing, e.g. `echo **/*.txt`
for option in autocd globstar; do
    shopt -s "$option" 2> /dev/null;
done;

# Add tab completion for many Bash commands
if which brew > /dev/null && [ -f "$(brew --prefix)/share/bash-completion/bash_completion" ]; then
    source "$(brew --prefix)/share/bash-completion/bash_completion";
elif [ -f /etc/bash_completion ]; then
    source /etc/bash_completion;
fi;

# Enable tab completion for `g` by marking it as an alias for `git`
if type _git &> /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
    complete -o default -o nospace -F _git g;
fi;

# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh;

# Add tab completion for `defaults read|write NSGlobalDomain`
# You could just use `-g` instead, but I like being explicit
complete -W "NSGlobalDomain" defaults;

# Add `killall` tab completion for common apps
complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal Twitter" killall;

source ~/.profile

# source /usr/local/opt/autoenv/activate.sh
ypresto commented 8 years ago

@huguesbr @jlaws

Thanks, reproduced using .bash_prompt from @huguesbr's dotfiles repo.

You should not load contents of .bash_prompt if shell is not interactive. Please refer below link and add if statement on appropriate place. :) https://www.gnu.org/software/bash/manual/html_node/Is-this-Shell-Interactive_003f.html

huguesbr commented 8 years ago

@ypresto cool thx

shayanbo commented 8 years ago

so, how to fix it ?

huguesbr commented 8 years ago

@MickeyHub don't load your .bash_profile if not interactive: [ -n "$PS1" ] && source ~/.bash_profile;