"""astyle plugin for zazu"""
import zazu.styler
import zazu.util

__author__ = "Nicholas Wiles"
__copyright__ = "Copyright 2017"


class AstyleStyler(zazu.styler.Styler):
    """Astyle plugin for code styling"""

    def style_file(self, file, verbose, dry_run):
        """Run astyle on a file"""
        args = ['astyle', '-v'] + self.options
        if dry_run:
            args.append('--dry-run')
        args.append(file)
        output = zazu.util.check_output(args)
        fix_needed = output.startswith('Formatted  ')
        return file, fix_needed

    @staticmethod
    def default_extensions():
        return ['*.c',
                '*.cc',
                '*.cpp',
                '*.h',
                '*.hpp',
                '*.java']

    @staticmethod
    def type():
        return 'astyle'

"""astyle plugin for zazu"""
import zazu.styler
import zazu.util

__author__ = "Nicholas Wiles"
__copyright__ = "Copyright 2017"


class AstyleStyler(zazu.styler.Styler):
    """Astyle plugin for code styling"""

    def style_file(self, file, verbose, dry_run):
        """Run astyle on a file"""
        args = ['astyle', '--formatted'] + self.options
        if dry_run:
            args.append('--dry-run')
        args.append(file)
        output = zazu.util.check_output(args)
        return file, bool(output)

    @staticmethod
    def default_extensions():
        return ['*.c',
                '*.cc',
                '*.cpp',
                '*.h',
                '*.hpp',
                '*.java']

    @staticmethod
    def type():
        return 'astyle'

Use formatted flag on astyle to simplify code
Use formatted flag on astyle to simplify code

  """astyle plugin for zazu"""
  import zazu.styler
  import zazu.util
  
  __author__ = "Nicholas Wiles"
  __copyright__ = "Copyright 2017"
  
  
  class AstyleStyler(zazu.styler.Styler):
      """Astyle plugin for code styling"""
  
      def style_file(self, file, verbose, dry_run):
          """Run astyle on a file"""
-         args = ['astyle', '-v'] + self.options
+         args = ['astyle', '--formatted'] + self.options
          if dry_run:
              args.append('--dry-run')
          args.append(file)
          output = zazu.util.check_output(args)
+         return file, bool(output)
-         fix_needed = output.startswith('Formatted  ')
-         return file, fix_needed
  
      @staticmethod
      def default_extensions():
          return ['*.c',
                  '*.cc',
                  '*.cpp',
                  '*.h',
                  '*.hpp',
                  '*.java']
  
      @staticmethod
      def type():
          return 'astyle'
  
Use formatted flag on astyle to simplify code
## Code Before:
"""astyle plugin for zazu"""
import zazu.styler
import zazu.util

__author__ = "Nicholas Wiles"
__copyright__ = "Copyright 2017"


class AstyleStyler(zazu.styler.Styler):
    """Astyle plugin for code styling"""

    def style_file(self, file, verbose, dry_run):
        """Run astyle on a file"""
        args = ['astyle', '-v'] + self.options
        if dry_run:
            args.append('--dry-run')
        args.append(file)
        output = zazu.util.check_output(args)
        fix_needed = output.startswith('Formatted  ')
        return file, fix_needed

    @staticmethod
    def default_extensions():
        return ['*.c',
                '*.cc',
                '*.cpp',
                '*.h',
                '*.hpp',
                '*.java']

    @staticmethod
    def type():
        return 'astyle'

## Instruction:
Use formatted flag on astyle to simplify code
## Code After:
"""astyle plugin for zazu"""
import zazu.styler
import zazu.util

__author__ = "Nicholas Wiles"
__copyright__ = "Copyright 2017"


class AstyleStyler(zazu.styler.Styler):
    """Astyle plugin for code styling"""

    def style_file(self, file, verbose, dry_run):
        """Run astyle on a file"""
        args = ['astyle', '--formatted'] + self.options
        if dry_run:
            args.append('--dry-run')
        args.append(file)
        output = zazu.util.check_output(args)
        return file, bool(output)

    @staticmethod
    def default_extensions():
        return ['*.c',
                '*.cc',
                '*.cpp',
                '*.h',
                '*.hpp',
                '*.java']

    @staticmethod
    def type():
        return 'astyle'
