Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkstyle and ktlint updates #185

Merged
merged 4 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 36 additions & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ abstract class TopLevelFragment : Fragment(), TopLevelFragmentView {
childFragmentManager.addOnBackStackChangedListener(this)
}

final override fun onCreateView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {
final override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val layout: FrameLayout = inflater.inflate(R.layout.fragment_parent,
container, false) as FrameLayout
val view: View? = onCreateFragmentView(inflater, layout, savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ interface TopLevelFragmentView : FragmentManager.OnBackStackChangedListener {
* Inflate the fragment view and return to be added to the parent
* container.
*/
fun onCreateFragmentView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View?
fun onCreateFragmentView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View?

/**
* Return the title that should appear in the action bar while this fragment is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ class DashboardFragment : TopLevelFragment() {
fun newInstance() = DashboardFragment()
}

override fun onCreateFragmentView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {
override fun onCreateFragmentView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_dashboard, container, false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,12 @@ class LoginActivity : AppCompatActivity(), LoginListener, GoogleListener, HasSup
slideInFragment(loginSiteAddressFragment, true, LoginSiteAddressFragment.TAG)
}

override fun loginViaSocialAccount(email: String?, idToken: String?, service: String?,
isPasswordRequired: Boolean) {
override fun loginViaSocialAccount(
email: String?,
idToken: String?,
service: String?,
isPasswordRequired: Boolean
) {
val loginEmailPasswordFragment = LoginEmailPasswordFragment.newInstance(email, null, idToken,
service, isPasswordRequired)
slideInFragment(loginEmailPasswordFragment, true, LoginEmailPasswordFragment.TAG)
Expand Down Expand Up @@ -190,8 +194,13 @@ class LoginActivity : AppCompatActivity(), LoginListener, GoogleListener, HasSup
slideInFragment(login2FaFragment, true, Login2FaFragment.TAG)
}

override fun needs2faSocial(email: String?, userId: String?, nonceAuthenticator: String?, nonceBackup: String?,
nonceSms: String?) {
override fun needs2faSocial(
email: String?,
userId: String?,
nonceAuthenticator: String?,
nonceBackup: String?,
nonceSms: String?
) {
loginAnalyticsListener.trackLoginSocial2faNeeded()
val login2FaFragment = Login2FaFragment.newInstanceSocial(email, userId,
nonceAuthenticator, nonceBackup, nonceSms)
Expand Down Expand Up @@ -225,8 +234,10 @@ class LoginActivity : AppCompatActivity(), LoginListener, GoogleListener, HasSup
slideInFragment(loginUsernamePasswordFragment, true, LoginUsernamePasswordFragment.TAG)
}

override fun handleSslCertificateError(memorizingTrustManager: MemorizingTrustManager?,
callback: LoginListener.SelfSignedSSLCallback?) {
override fun handleSslCertificateError(
memorizingTrustManager: MemorizingTrustManager?,
callback: LoginListener.SelfSignedSSLCallback?
) {
// TODO: Support self-signed SSL sites and show dialog (only needed when XML-RPC support is added)
}

Expand Down Expand Up @@ -307,8 +318,12 @@ class LoginActivity : AppCompatActivity(), LoginListener, GoogleListener, HasSup

// SmartLock

override fun saveCredentialsInSmartLock(username: String?, password: String?, displayName: String,
profilePicture: Uri?) {
override fun saveCredentialsInSmartLock(
username: String?,
password: String?,
displayName: String,
profilePicture: Uri?
) {
// TODO: Hook for smartlock, if using
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import javax.inject.Inject

@OpenClassOnDebug
class MainPresenter @Inject constructor(
private val dispatcher: Dispatcher,
private val accountStore: AccountStore,
private val siteStore: SiteStore,
private val wooCommerceStore: WooCommerceStore
private val dispatcher: Dispatcher,
private val accountStore: AccountStore,
private val siteStore: SiteStore,
private val wooCommerceStore: WooCommerceStore
) : MainContract.Presenter {
private var mainView: MainContract.View? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ class NotificationsFragment : TopLevelFragment() {
fun newInstance() = NotificationsFragment()
}

override fun onCreateFragmentView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {
override fun onCreateFragmentView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_notifications, container, false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ class OrderListFragment : TopLevelFragment(), OrderListContract.View {
super.onAttach(context)
}

override fun onCreateFragmentView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {
override fun onCreateFragmentView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_order_list, container, false)
with(view) {
orderRefreshLayout?.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import org.wordpress.android.fluxc.store.WCOrderStore.FetchOrdersPayload
import org.wordpress.android.fluxc.store.WCOrderStore.OnOrderChanged
import javax.inject.Inject

class OrderListPresenter @Inject constructor(private val dispatcher: Dispatcher,
private val orderStore: WCOrderStore
class OrderListPresenter @Inject constructor(
private val dispatcher: Dispatcher,
private val orderStore: WCOrderStore
) : OrderListContract.Presenter {
private var orderView: OrderListContract.View? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ import android.view.View
* @param [clipToMargin] True if the divider should also clip itself to match the margins of the provided components.
* Default is false.
*/
class AlignedDividerDecoration @JvmOverloads constructor(ctx: Context,
private val orientation: Int,
private val alignStartToStartOf: Int = 0,
private val alignEndToEndOf: Int = 0,
private val clipToMargin: Boolean = false)
class AlignedDividerDecoration @JvmOverloads constructor(
ctx: Context,
private val orientation: Int,
private val alignStartToStartOf: Int = 0,
private val alignEndToEndOf: Int = 0,
private val clipToMargin: Boolean = false
)
: RecyclerView.ItemDecoration() {
companion object {
const val HORIZONTAL = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import com.woocommerce.android.R
* @attr ref com.woocommerce.android.R.styleable#FlowLayout_horizontalSpacing
* @attr ref com.woocommerce.android.R.styleable#FlowLayout_verticalSpacing
*/
open class FlowLayout @JvmOverloads constructor(context: Context,
attrs: AttributeSet? = null) : ViewGroup(context, attrs) {
open class FlowLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
) : ViewGroup(context, attrs) {
private var mHorizontalSpacing: Int = 0
private var mVerticalSpacing: Int = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import android.view.View
*
* see https://github.com/googlesamples/android-architecture
*/
class ScrollChildSwipeRefreshLayout @JvmOverloads constructor(context: Context,
attrs: AttributeSet? = null)
class ScrollChildSwipeRefreshLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
)
: SwipeRefreshLayout(context, attrs) {
var scrollUpChild: View? = null

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.automattic.android:fetchstyle:1.0'
classpath 'com.automattic.android:fetchstyle:1.1'
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
}
}
Expand Down Expand Up @@ -53,7 +53,7 @@ subprojects {
}

dependencies {
ktlint 'com.github.shyiko:ktlint:0.14.0'
ktlint 'com.github.shyiko:ktlint:0.21.0'
}

task ktlint(type: JavaExec) {
Expand Down
6 changes: 6 additions & 0 deletions config/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
<property name="severity" value="error"/>
</module>

<module name="RegexpSingleline">
<property name="format" value="^(?!.*\bimport\b).*Store\.[A-Z][A-Za-z0-9]*[ );]"/>
<property name="message" value="Specific imports should be used for FluxC Store inner classes"/>
<property name="severity" value="error"/>
</module>

<module name="RegexpMultiline">
<property name="format" value="@Inject(\n|\r\n).*[^{,(]$"/>
<property name="message" value="Inject annotation should be in-line with the annotated field or property"/>
Expand Down
2 changes: 2 additions & 0 deletions libs/login/.idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions libs/login/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion libs/login/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading