PRESUBMIT: Improve PyLint check and add GN format check.

Add pylintrc file based on
https://code.google.com/p/chromium/codesearch#chromium/src/tools/perf/pylintrc
bit tightened up quite a bit (the one in depot_tools is far
more relaxed).

Remove a few excluded directories from pylint check and fixed/
suppressed all warnings generated.

Add GN format check + formatted all GN files using 'gn format'.
Cleanup redundant rules in tools/PRESUBMIT.py

TESTED=Ran 'git cl presubmit -vv', fixed the PyLint violations.
Ran it again with a modification in webrtc/build/webrtc.gni, formatted
all the GN files and ran it again.

R=henrika@webrtc.org, phoglund@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/50069004

Cr-Commit-Position: refs/heads/master@{#9274}
diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn
index 6593ed6..896b664 100644
--- a/webrtc/modules/audio_coding/BUILD.gn
+++ b/webrtc/modules/audio_coding/BUILD.gn
@@ -86,7 +86,9 @@
   ]
   configs += [ "../..:common_config" ]
   public_configs = [ "../..:common_inherited_config" ]
-  deps = [ "../..:webrtc_common" ]
+  deps = [
+    "../..:webrtc_common",
+  ]
 }
 
 source_set("audio_encoder_interface") {
@@ -96,7 +98,9 @@
   ]
   configs += [ "../..:common_config" ]
   public_configs = [ "../..:common_inherited_config" ]
-  deps = [ "../..:webrtc_common" ]
+  deps = [
+    "../..:webrtc_common",
+  ]
 }
 
 config("cng_config") {
@@ -130,9 +134,7 @@
 }
 
 config("red_config") {
-  include_dirs = [
-    "codecs/red",
-  ]
+  include_dirs = [ "codecs/red" ]
 }
 
 source_set("red") {
@@ -163,12 +165,12 @@
 
 source_set("g711") {
   sources = [
-    "codecs/g711/include/audio_encoder_pcm.h",
-    "codecs/g711/include/g711_interface.h",
     "codecs/g711/audio_encoder_pcm.cc",
-    "codecs/g711/g711_interface.c",
     "codecs/g711/g711.c",
     "codecs/g711/g711.h",
+    "codecs/g711/g711_interface.c",
+    "codecs/g711/include/audio_encoder_pcm.h",
+    "codecs/g711/include/g711_interface.h",
   ]
 
   configs += [ "../..:common_config" ]
@@ -178,7 +180,9 @@
     ":g711_config",
   ]
 
-  deps = [ ":audio_encoder_interface" ]
+  deps = [
+    ":audio_encoder_interface",
+  ]
 }
 
 config("g722_config") {
@@ -191,12 +195,12 @@
 source_set("g722") {
   sources = [
     "codecs/g722/audio_encoder_g722.cc",
-    "codecs/g722/include/audio_encoder_g722.h",
-    "codecs/g722/include/g722_interface.h",
-    "codecs/g722/g722_interface.c",
-    "codecs/g722/g722_encode.c",
     "codecs/g722/g722_decode.c",
     "codecs/g722/g722_enc_dec.h",
+    "codecs/g722/g722_encode.c",
+    "codecs/g722/g722_interface.c",
+    "codecs/g722/include/audio_encoder_g722.h",
+    "codecs/g722/include/g722_interface.h",
   ]
 
   configs += [ "../..:common_config" ]
@@ -206,7 +210,9 @@
     ":g722_config",
   ]
 
-  deps = [ ":audio_encoder_interface" ]
+  deps = [
+    ":audio_encoder_interface",
+  ]
 }
 
 config("ilbc_config") {
@@ -218,28 +224,27 @@
 
 source_set("ilbc") {
   sources = [
-    "codecs/ilbc/audio_encoder_ilbc.cc",
-    "codecs/ilbc/include/audio_encoder_ilbc.h",
     "codecs/ilbc/abs_quant.c",
     "codecs/ilbc/abs_quant.h",
     "codecs/ilbc/abs_quant_loop.c",
     "codecs/ilbc/abs_quant_loop.h",
+    "codecs/ilbc/audio_encoder_ilbc.cc",
     "codecs/ilbc/augmented_cb_corr.c",
     "codecs/ilbc/augmented_cb_corr.h",
     "codecs/ilbc/bw_expand.c",
     "codecs/ilbc/bw_expand.h",
     "codecs/ilbc/cb_construct.c",
     "codecs/ilbc/cb_construct.h",
+    "codecs/ilbc/cb_mem_energy.c",
+    "codecs/ilbc/cb_mem_energy.h",
     "codecs/ilbc/cb_mem_energy_augmentation.c",
     "codecs/ilbc/cb_mem_energy_augmentation.h",
-    "codecs/ilbc/cb_mem_energy.c",
     "codecs/ilbc/cb_mem_energy_calc.c",
     "codecs/ilbc/cb_mem_energy_calc.h",
-    "codecs/ilbc/cb_mem_energy.h",
     "codecs/ilbc/cb_search.c",
+    "codecs/ilbc/cb_search.h",
     "codecs/ilbc/cb_search_core.c",
     "codecs/ilbc/cb_search_core.h",
-    "codecs/ilbc/cb_search.h",
     "codecs/ilbc/cb_update_best_index.c",
     "codecs/ilbc/cb_update_best_index.h",
     "codecs/ilbc/chebyshev.c",
@@ -263,12 +268,12 @@
     "codecs/ilbc/encode.h",
     "codecs/ilbc/energy_inverse.c",
     "codecs/ilbc/energy_inverse.h",
+    "codecs/ilbc/enh_upsample.c",
+    "codecs/ilbc/enh_upsample.h",
     "codecs/ilbc/enhancer.c",
     "codecs/ilbc/enhancer.h",
     "codecs/ilbc/enhancer_interface.c",
     "codecs/ilbc/enhancer_interface.h",
-    "codecs/ilbc/enh_upsample.c",
-    "codecs/ilbc/enh_upsample.h",
     "codecs/ilbc/filtered_cb_vecs.c",
     "codecs/ilbc/filtered_cb_vecs.h",
     "codecs/ilbc/frame_classify.c",
@@ -288,6 +293,7 @@
     "codecs/ilbc/hp_output.c",
     "codecs/ilbc/hp_output.h",
     "codecs/ilbc/ilbc.c",
+    "codecs/ilbc/include/audio_encoder_ilbc.h",
     "codecs/ilbc/index_conv_dec.c",
     "codecs/ilbc/index_conv_dec.h",
     "codecs/ilbc/index_conv_enc.c",
@@ -397,8 +403,8 @@
     "codecs/isac/main/source/codec.h",
     "codecs/isac/main/source/crc.c",
     "codecs/isac/main/source/crc.h",
-    "codecs/isac/main/source/decode_bwe.c",
     "codecs/isac/main/source/decode.c",
+    "codecs/isac/main/source/decode_bwe.c",
     "codecs/isac/main/source/encode.c",
     "codecs/isac/main/source/encode_lpc_swb.c",
     "codecs/isac/main/source/encode_lpc_swb.h",
@@ -406,10 +412,10 @@
     "codecs/isac/main/source/entropy_coding.h",
     "codecs/isac/main/source/fft.c",
     "codecs/isac/main/source/fft.h",
-    "codecs/isac/main/source/filterbanks.c",
+    "codecs/isac/main/source/filter_functions.c",
     "codecs/isac/main/source/filterbank_tables.c",
     "codecs/isac/main/source/filterbank_tables.h",
-    "codecs/isac/main/source/filter_functions.c",
+    "codecs/isac/main/source/filterbanks.c",
     "codecs/isac/main/source/intialize.c",
     "codecs/isac/main/source/isac.c",
     "codecs/isac/main/source/lattice.c",
@@ -477,17 +483,17 @@
     "codecs/isac/fix/source/bandwidth_estimator.c",
     "codecs/isac/fix/source/bandwidth_estimator.h",
     "codecs/isac/fix/source/codec.h",
-    "codecs/isac/fix/source/decode_bwe.c",
     "codecs/isac/fix/source/decode.c",
+    "codecs/isac/fix/source/decode_bwe.c",
     "codecs/isac/fix/source/decode_plc.c",
     "codecs/isac/fix/source/encode.c",
     "codecs/isac/fix/source/entropy_coding.c",
     "codecs/isac/fix/source/entropy_coding.h",
     "codecs/isac/fix/source/fft.c",
     "codecs/isac/fix/source/fft.h",
-    "codecs/isac/fix/source/filterbanks.c",
     "codecs/isac/fix/source/filterbank_tables.c",
     "codecs/isac/fix/source/filterbank_tables.h",
+    "codecs/isac/fix/source/filterbanks.c",
     "codecs/isac/fix/source/filters.c",
     "codecs/isac/fix/source/initialize.c",
     "codecs/isac/fix/source/isacfix.c",
@@ -544,17 +550,13 @@
     # //build/config/arm.gni instead, to reduce code duplication.
     # Remove the -mfpu=vfpv3-d16 cflag.
     configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
-    cflags = [
-      "-mfpu=neon",
-    ]
+    cflags = [ "-mfpu=neon" ]
 
     sources += [
       "codecs/isac/fix/source/lattice_armv7.S",
       "codecs/isac/fix/source/pitch_filter_armv6.S",
     ]
-    sources -= [
-      "codecs/isac/fix/source/pitch_filter_c.c",
-    ]
+    sources -= [ "codecs/isac/fix/source/pitch_filter_c.c" ]
   }
 
   if (current_cpu == "mipsel") {
@@ -565,22 +567,16 @@
       "codecs/isac/fix/source/pitch_estimator_mips.c",
       "codecs/isac/fix/source/transform_mips.c",
     ]
-    sources -= [
-      "codecs/isac/fix/source/pitch_estimator_c.c"
-    ]
+    sources -= [ "codecs/isac/fix/source/pitch_estimator_c.c" ]
     if (mips_dsp_rev > 0) {
-      sources += [
-        "codecs/isac/fix/source/filterbanks_mips.c"
-      ]
+      sources += [ "codecs/isac/fix/source/filterbanks_mips.c" ]
     }
     if (mips_dsp_rev > 1) {
       sources += [
         "codecs/isac/fix/source/lpc_masking_model_mips.c",
         "codecs/isac/fix/source/pitch_filter_mips.c",
       ]
-      sources -= [
-        "codecs/isac/fix/source/pitch_filter_c.c"
-      ]
+      sources -= [ "codecs/isac/fix/source/pitch_filter_c.c" ]
     }
   }
 
@@ -606,16 +602,14 @@
       # //build/config/arm.gni instead, to reduce code duplication.
       # Remove the -mfpu=vfpv3-d16 cflag.
       configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
-      cflags = [
-        "-mfpu=neon",
-      ]
+      cflags = [ "-mfpu=neon" ]
     }
 
     if (current_cpu != "arm64" || !is_clang) {
       # Disable AllpassFilter2FixDec16Neon function due to a clang bug.
       # Refer more details at:
       # https://code.google.com/p/webrtc/issues/detail?id=4567
-        sources += [ "codecs/isac/fix/source/filterbanks_neon.c", ]
+      sources += [ "codecs/isac/fix/source/filterbanks_neon.c" ]
     }
 
     # Disable LTO in audio_processing_neon target due to compiler bug.
@@ -629,7 +623,9 @@
     configs += [ "../..:common_config" ]
     public_configs = [ "../..:common_inherited_config" ]
 
-    deps = [ "../../common_audio" ]
+    deps = [
+      "../../common_audio",
+    ]
   }
 }
 
@@ -642,9 +638,9 @@
 
 source_set("pcm16b") {
   sources = [
+    "codecs/pcm16b/audio_encoder_pcm16b.cc",
     "codecs/pcm16b/include/audio_encoder_pcm16b.h",
     "codecs/pcm16b/include/pcm16b.h",
-    "codecs/pcm16b/audio_encoder_pcm16b.cc",
     "codecs/pcm16b/pcm16b.c",
   ]
 
@@ -674,7 +670,9 @@
     "codecs/opus/opus_interface.c",
   ]
 
-  deps = [ ":audio_encoder_interface" ]
+  deps = [
+    ":audio_encoder_interface",
+  ]
 
   if (rtc_build_opus) {
     configs += [ "../..:common_config" ]
@@ -697,7 +695,6 @@
 
 source_set("neteq") {
   sources = [
-    "neteq/interface/neteq.h",
     "neteq/accelerate.cc",
     "neteq/accelerate.h",
     "neteq/audio_classifier.cc",
@@ -735,13 +732,12 @@
     "neteq/dtmf_tone_generator.h",
     "neteq/expand.cc",
     "neteq/expand.h",
+    "neteq/interface/neteq.h",
     "neteq/merge.cc",
     "neteq/merge.h",
+    "neteq/neteq.cc",
     "neteq/neteq_impl.cc",
     "neteq/neteq_impl.h",
-    "neteq/neteq.cc",
-    "neteq/statistics_calculator.cc",
-    "neteq/statistics_calculator.h",
     "neteq/normal.cc",
     "neteq/normal.h",
     "neteq/packet_buffer.cc",
@@ -756,12 +752,14 @@
     "neteq/random_vector.h",
     "neteq/rtcp.cc",
     "neteq/rtcp.h",
+    "neteq/statistics_calculator.cc",
+    "neteq/statistics_calculator.h",
     "neteq/sync_buffer.cc",
     "neteq/sync_buffer.h",
-    "neteq/timestamp_scaler.cc",
-    "neteq/timestamp_scaler.h",
     "neteq/time_stretch.cc",
     "neteq/time_stretch.h",
+    "neteq/timestamp_scaler.cc",
+    "neteq/timestamp_scaler.h",
   ]
 
   configs += [ "../..:common_config" ]